Take the 2-minute tour ×

As a follow up to a question I asked recently, I'm having some problems.

Take a look at this fiddle: http://jsfiddle.net/Lzhf6/9/. If you scroll down the page and then scroll back up very quickly (using mouse wheel is best), the header gets stuck before it can reach its correct position. It's a bit awkward to explain without viewing the fiddle so please do take a look at that.

What I need is for the Javascript to detect when this has happened and then reset it automatically to the actual correct position.

Any help appreciated.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I tried resetting the css top

if (scrollY > headtop) {
        top: scrollY
} else {
    $("tr[name='headerrow']").children().css('top', '');

please see: http://jsfiddle.net/eFNPG/2/

I tried your code on Chrome, the header stays on top. But when I tried it on Firefox 3.6 the header doesn't stay on top. (even the original code: http://jsfiddle.net/Lzhf6/9/)

share|improve this answer
Great, thanks. That seems to have fixed it on the application that the fiddle was based on. Point taken about the browsers, however (famous last words), I'm developing for an intranet which only supports IE, so I should, at least for now, be ok. –  Arjun Jun 15 '11 at 15:13

Your Answer


