html - Choosing how far you scroll before a jquery animate activates -


i have code

$(window).load(function () {             $elem1 = $('#div1');             $elem2 = $('#div2');             var scrollstate = 'top';             $(window).scroll(function () {                 var scrollpos = $(window).scrolltop();                 if ((scrollpos != 0) && (scrollstate === 'top')) {                     $elem1.stop().animate({                         opacity: '1.0'                     }, 300);                     $elem2.stop().animate({                         marginleft: '50px'                     }, 300);                     scrollstate = 'scrolled';                 } else if ((scrollpos === 0) && (scrollstate === 'scrolled')) {                     $elem1.stop().animate({                         opacity: '0.0'                     }, 300);                     $elem2.stop().animate({                         marginleft: '0px'                     }, 300);                     scrollstate = 'top';                 }             }); }); //]]> 

when scroll down page jquery activates start scrolling. able choose how far down page go before activates.

can't check on value of scrollpos?

if(scrollpos > x && (scrollstate === 'top')) {     //activate } else {     //do nothing } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo