bigspotteddog/ScrollToFixed — pull request #35 by jwoldan (2012-08-15 18:08:25+00:00)
Title: Two fixes for bug occurring in a responsive design using ScrollToFixed

I encountered two bugs when attempting to incorporate ScrollToFixed into a responsive design I am working on. The first commit addresses a bug where when the "ScrollToFixed" element was hidden (for small display sizes), there would be a flash of the element appearing in a weird position onscreen, due to the changing layout. I fixed this by checking in the WindowResize function if the element is visible before executing the function body.

The second bug is a bit more complex. In this design the "ScrollToFixed" element has a left margin set which was throwing off the horizontal positioning of the element. I was able to use the callback functions (fixed, preUnfixed, preAbsolute) to account for this, but was finding that due to the responsive/flexible (percentage-based) positioning of the design, if I scrolled, then resized the screen horizontally, the horizontal positioning of the element would again be thrown off. I was able to fix this by adding calls to preUnfixed and unfixed around two calls to setUnfixed() where they were missing. This ensures that the the element position is consistently recalculated on each window resize, taking into account it's new position in the responsive/flexible design.

Thanks for developing the plugin; with these two fixes this should work for the design I'm working on. I hope these two commits are useful updates.