Reputation: 1093
I'd like to do something like:
var scrollable;
scrollable = $(window).scrollTo(99999, 99999);
$(window).scroll(function() {
// cancel the scrollTo
scrollable = null;
});
Upvotes: 0
Views: 2547
Reputation: 1250
Based on jonobr1's code this works for me:
if(window.addEventListener) document.addEventListener('DOMMouseScroll', stopScroll, false);
document.onmousewheel = stopScroll;
function stopScroll() {
$(window)._scrollable().stop(true, false); // Stops and dequeue's animations
}
I added a call to stopScroll before my scrollTo calls in my event handlers too.
Upvotes: 1
Reputation: 1093
After some fiddling I found this to work well.
$(window).scrollTo(99999, 99999);
$(window).click(function() {
stopScroll();
});
if(window.addEventListener) document.addEventListener('DOMMouseScroll', stopScroll, false);
document.onmousewheel = stopScroll;
function stopScroll() {
$(window).stop(true, false); // Stops and dequeue's animations
}
No need to modify plugin or source!
Upvotes: 0