Configure speed and ease in
jonalange opened this issue · comments
Hi,
this script (in combination with jquery.localScroll) is included in a wordpress theme I bought. Unfortunately the author won't support on this.
In it's own demo the scroll is smooth and accelerates (with some easing, starts slow, gets fast and slows down again).
On my page the scroll is linear and takes the same time no matter what the distance. So if two sections are really close to each other, it's super slow and monotone. You really get bored while watching the slow scroll. While on a large distance it's so fast you can't even follow whats happening.
I tried to look into the code on the demo page of the theme but the minified files are the same and I don't really get where I could configure this or where a config would get pulled from.
If you could assist me here it would be really great.
Thanks!
Demo page: https://essential.ravenbluethemes.com/
Hi, that's not supported. It's only duration
which is fixed, this is passed as-is to jQuery.animate.
One solution is to use the onBefore
callback of localScroll. In it you can calculate the distance that will be scrolled (a bit complex but doable using a combination of $().scrollTop()
and $().offset().top
I suppose) and update the duration
based on a constant speed
.
Remember speed = distance / duration
hence duration = distance / speed
.