Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Support for overflow scroll #152

Open
ErikVeland opened this issue Mar 15, 2016 · 0 comments
Open

Support for overflow scroll #152

ErikVeland opened this issue Mar 15, 2016 · 0 comments

Comments

@ErikVeland
Copy link

This took me quite some time to fix. I thought support for scrolling a div would be as easy as changing this.$win = $(window); to this.$win = $('.onCanvas'); which in theory should work. Many hours of debugging later I found that the fix was to change the getPositions function from topPos = $target.offset().top; to topPos = $target.position().top;

offset().top returns the elements position relative to the document, whereas position().top returns the position relative to its parent element. I believe you can safely change this to support both document scroll and overflow scroll.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant