Sorry for double post...
Thanks , simple and works! I've almost no knowledge of javascrpit but
jquery is very powerful and intuitive...i'm trying to make a sort of
horizontal menu with incorporated a slide for navigate to left and
right...it's essentially a trivial thing but if i can make something
userful  i'd like to share here.

On 11 Apr, 14:18, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> Declare the variable in the same scope as each of those functions is
> declared. For example:
>
> $(function() {
>
>   var pointX;
>
>   $(".nav_slider").mousemove(function(e) { ... // set pointX here ... });
>
>   $(document).scroll(function() { ...// use pointX here... });
>
> });
>
> - Richard
>
> Richard D. Worthhttp://rdworth.org/
>
> On Fri, Apr 11, 2008 at 4:33 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 );
> >  });
>
> > How i can retrieve it?

Reply via email to