looks good. pointX is a global variable and can be accessed by both
functions. What's the problem?

On Apr 11, 6:13 am, Decagrog <[EMAIL PROTECTED]> wrote:
> 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 );
>   });

Reply via email to