scrollIt.js
scrollIt.js copied to clipboard
Multiple clicking the same link bug
When you click on the same data-scroll-nav a lot of times and try to scroll the page after that, the script scroll to data-scroll-index exact the same times of clicks count.
This create bad glitch effect.
I am using Mac with Firefox 47.0
The bug happen, because you do not disable click on the same data-scroll-nav. When i click 10 times, it take 10xsettings.scrollTime.
You can update your doScroll method to disabled animation if target and current data-scroll-nav are the same.
var doScroll = function (e) {
var target = $(e.target).closest("[data-scroll-nav]").attr('data-scroll-nav') ||
$(e.target).closest("[data-scroll-goto]").attr('data-scroll-goto');
var current = $('[data-scroll-nav].active').attr('data-scroll-nav');
if (target === current) {
return;
}
navigate(parseInt(target));
};