javascript - jQuery onScroll() show and hide DIVs -


i have simple onscroll function, shows div when scroll (down) height 100 example, , if scrolled reach 100 hides div, works perfect.

however, if scroll down , while showing div if scroll & down 2 3 times, doesn't catch event, if again, still shows div, again if scroll 1 pixel down, hides , if reaches 100 shows div again.. hope made clear, dont have online demo working on localhost.. below function using standalone in template within <*script> tag..

  jquery(document).scroll(function ($) {        var y = jquery(this).scrolltop();           var hoffset = 100;        if (y > hoffset) {           // show div       } else {           // hide div       }   }); 

can please guide me right direction, other best approaches can done this, doing header nav div..

regards

do want this? see fiddle

i use fadein() , fadeout() instead.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -