jquery - How do I trigger an event after a certain amount of scrolling? -


i'm using little code , it's working fine header img. later on page want use same effect again. except action called first moment begin scroll. want action happen when i'm @ relevant div, or after amount of pixels. need add?

thanks in advance!

<script>     $(window).scroll(function() {     var s = $(window).scrolltop(),     opacityval = (s / 150.0);     $('.blur_img').css('opacity', opacityval); }); </script> 

you have add check in code:

.scrolltop() returns how user has scrolled vertically.

<script> $(window).scroll(function() {     var s = $(window).scrolltop();      if (s > 200) {         opacityval = (s / 150.0);         $('.blur_img').css('opacity', opacityval);     } }); </script> 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -