jQuery-One-Page-Nav icon indicating copy to clipboard operation
jQuery-One-Page-Nav copied to clipboard

Support for overflow scroll

Open ErikVeland opened this issue 8 years ago • 0 comments

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.

ErikVeland avatar Mar 15 '16 04:03 ErikVeland