This scroll animation trigger the complete handler twice..
$('html,body').stop().animate({
scrollTop : 100
}, {
duration : 600,
complete : function(){
console.log('scroll complete');
}
});
If you remove either html or body in the selector the scroll animation loose its cross browser support...
The animation is triggered on both elements, firing the complete handler for both elements.
You can use a promise to avoid it
$('html,body').stop()
.animate({scrollTop : 100}, 600)
.promise()
.done(function() {
console.log('scroll complete');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With