Reputation: 2046
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.
Upvotes: 0
Views: 396
Reputation: 332
I tried resetting the css top
if (scrollY > headtop) {
$("tr[name='headerrow']").children().offset({
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/)
Upvotes: 3