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 532 forks source link

Fixed element moving out of position incorrectly #99

Closed lewismalpas closed 11 years ago

lewismalpas commented 11 years ago

Hi,

Firstly, thank you for creating such a helpful plugin...

I am having a few issues with the position of the element which needs to stay fixed when the user scrolls down the page and the top of the browser hits the element. At the moment the element, the go to the top of the page arrow, jumps out of position too early:

http://lewismalpas.co.uk/aaron/portfolio/lewis-test-post/

The up arrow should stay fixed beneath the image carousel however it jumps out of position as soon as the browser is scrolled. The up arrow itself should be positioned to the right of the copy and shouldn't ever go on top of the image carousel.

Any help would be appreciated,

Many thanks, Lewis.

bigspotteddog commented 11 years ago

The carousel is loading after .scrollToFixed is called, which is changing the targeted scroll position. Call .scrollToFixed after the carousel is loaded. Or, call window.resize() after the carousel is loaded to get the plugin to recalculate.

Hope that helps.

lewismalpas commented 11 years ago

Many thanks for your help, I ended up calling the ScrollToFixed plugin in a callback function within the carousel and now everything works perfectly.

All the best!

bigspotteddog commented 11 years ago

Great! Best of luck!