[jQuery] Passing variables between two function
Hi all,
I've a newbie question about variable scope...essentially i've two
anonimous function and i need to retrieve a variable
generated into first function and use it in the second one.
Here the basic code to get an idea of what i'm trying...
var pointX ;
$(".nav_slider").mousemove(function(e){
pointX = e.pageX ;
// do some other stuff with pointX ...
});
$(document).scroll(function () {
var docH = $(window).height();
var docW = $(window).width();
docWcenter = docW / 2;
//here i need again pointX ...
$("#point").css( 'position',
'relative' ).animate({ left :docWcenter + pointX + "px"}, 200 );
});
How i can retrieve it?