If you're finding that the click event isn't triggering until after a momentum scroll is complete, consider using 'touchstart' to capture touch events instead of 'click'. Here's a handy jQuery solution:
$('#yourTrigger').on('touchstart', function () {
var $div = $('.yourScrollableDiv');
if ($div.scrollTop() === 0) {
return false; //Do nothing if no scrolling is needed
}
$div.addClass('scrolling');
$div.animate({
scrollTop: 0
}, 600, function () {
$div.removeClass('scrolling');
});
}
The 'scrolling' class applies an overflow:hidden style, which stops any momentum scrolling as @Patrick-Rudolph mentioned.
.scrolling {
overflow: hidden;
}
Remember to use a callback function to handle when your scroll animation finishes rather than relying on a timer function.