bigspotteddog / ScrollToFixed

This plugin is used to fix elements on the page (top, bottom, anywhere); however, it still allows the element to continue to move left or right with the horizontal scroll.
http://bigspotteddog.github.com/ScrollToFixed/
MIT License
1.81k stars 533 forks source link

long list of checkboxes throw fixed sidebar into "jump loop" #218

Open rvdb opened 8 years ago

rvdb commented 8 years ago

Hi,

Does scrollToFixed have a problem with checkboxes? I have a long sidebar whose content overflows the available height, so the sidebar will have a scroll bar. I've noticed how the contents of that sidebar start to jump between the top and a scrolled down position, when:

  1. it has been fixed with scrollToFixed (I mean, after its position has been fixed with scrollToFixed)
  2. the contents of that sidebar is scrolled

After that, it keeps jumping up and down, as if it is stuck in a loop. I'm suspecting checkboxes could be the problem, since the sidebar behaves normally when I remove them (I mean, I can scroll it up and down when fixed).

To illustrate this, I've created a fiddle at http://jsfiddle.net/rvdb/Lr2czs4p/, based on the "position_with_floats" test file shipped with the scrollToFixed download.

Note: the problem only seems to occur with Firefox (47.0, I'm on Windows 7 Pro 64 bit); Opera and Chrome behave well. Yet, even when there's no "jump-loop" (by removing the checkboxes from my example), scrolling (either the fixed sidebar or the rest of the page) gets very slow (close to unresponsive) on Firefox, once the sidebar has been fixed with scrollToFixed. Are there known issues in Firefox with interference of other listeners for scrolling events?

Best,

Ron

rvdb commented 8 years ago

Ah, I've found a workaround: move the height and overflow properties from the sidebar div to the form inside it. See the updated JSFiddle at http://jsfiddle.net/rvdb/Lr2czs4p/1/.

This solves both the scroll jump loop, and the slow scrolling in Firefox.

bigspotteddog commented 8 years ago

Hi Ron,

Thanks for the workaround. I was not aware there was an issue with Firefox for what you describe.

I will put together a FAQ or something that refers to your workaround for this case.

Thanks again!

rvdb commented 8 years ago

You're welcome (and thanks for the wonderful plugin!). I realize this might be a very specific problem in a very specific context; if you need more details or clarification, I'm happy to help you out.