vue-scrollto
vue-scrollto copied to clipboard
Programmatically triggered scroll doesn't have correct duration
Hi,
Firstly, thanks for this nice component :) Secondly, I think I found some bug. When I trigger scroll programmatically, duration isn't the same like in options object. You can see the problem in provided jsfiddle . onDone callback is triggered few seconds later after scroll end. ...or maybe I do sth wrong...
Thanks for any help
Seems like a combination of a few things:
- scroll height is only 1000px - could possibly have to do with very small scroll increments
- easing functions can affect the scroll's curve, and the final increments could be very tiny that the browser ignores them (scrolling by less than a pixel)
I'm not 100% sure this is correct - but generally speaking it's very rare to scroll with such long durations.
Well, in my app I have a list of elements with lower scroll duration and problem still exists (onDone starts moment later after scroll ends). In provided example I set 8 sec to make problem more visible. :) I was trying to set different easings, but still there is "a break" between scroll end and onDone.
Ok, figured it out - https://jsfiddle.net/o0bs36ew/ when adding a bottom margin (just so the scrollable area is longer) it works fine. In the original fiddle, it calculates how much it needs to scroll for the element to be at the top of the container - and keeps scrolling it beyond the max scrollable area - thus visually looking like the scrolling is complete - when it's actually still scrolling.