Take the 2-minute tour ×

I have a question but I actually do not know how to ask.

I am trying to make a navigation bar stick on top when pass a point smoothly.

My reference is this -> http://blog.yjl.im/2010/01/stick-div-at-top-after-scrolling.html

My problem is when I use IE or Chrome to check it, there is a "blink" effect.

It is more like the scroll function will finish process after scroll over the point. So the things(HTML) after Nav will go on the top of the Nav on 0.1 ~ 0.3 secs then scroll function will finish process. Even through is short but it is visualize-able when the HTML over the nav.

However, If I use Firefox to check it, there is no such blink effect.....

May I ask what is the problem here I got?? What Should I check about??

My setting is a Anchor right before the Nav, Nav z-index = 99, and inside of the scroll function is below.

            $(this).scrollTop() > $(anchor).offset().top
            ? nav.addClass('sticky')
            : nav.removeClass('sticky')
share|improve this question
Firefox has the smooth scroll option enabled by default which fires scroll events many times for each scroll while chrome only fires 1-2 scroll events, being one of them at the end of the default sharp scroll. –  Fabrício Matté Feb 2 '13 at 4:04
@FabrícioMatté Thank you very much, if so, how can I improve this?? When I check the reference example with Chrome or IE, they are just work fine...and how come I can not make it?? –  Till Feb 2 '13 at 4:06
As events firing is more of a browser aspect, this may not be easy to work around. Will try out some tricks to check. –  Fabrício Matté Feb 2 '13 at 4:12
add comment


Your Answer



Browse other questions tagged or ask your own question.