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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -