0

What I did was when I perform mousewheel event/scroll I cache the y coordinates and perform some simple math to get my desired position ansd that the div button will always scroll along with my mousewheel.

something like this:

$window.scroll(function() {
    $flMenu.css({"top":$windowY - $navY})
});

But the problem is that when I scroll slightly faster or testing it on a slow computer, the div flicker/ glitch out a little but the position still maintain the same.

Is there a way to improve/prevent flickering on the div which carried the dynamic values?

Vincent Chua
  • 969
  • 6
  • 20
  • 41
  • @Diodeus - This is not really related to that question. That is when the page is scrolled 100% down and then content loaded in bounces the scroll. This is when you scroll even at 10% and the element on the screen flickers as its top position is adjusted. – Travis J Dec 04 '13 at 18:50

1 Answers1

1

Instead of using position:absolute; and constantly adjusting the element to be from the top of the page as far down as the scroll goes you should determine the constant amount the element should be from the top of the page and then use position:fixed;. This will prevent the "flickering" that you are seeing.

Travis J
  • 81,153
  • 41
  • 202
  • 273