182
rated 0 times
[
187]
[
5]
/ answers: 1 / hits: 103047
/ 11 Years ago, mon, may 27, 2013, 12:00:00
I just wanted to get the mouse position using D3 by using the following code:
var x = 0;
svg.on('mousemove', function () {
x = d3.mouse(this)[0];
});
but x
is always equal to 0
. By using console.log()
, I can see that x
value is getting changed just inside the function()
but out of it x
got its initial value of 0
.
How can I save the x
value and use it later in my application?
More From » d3.js