I have this animation to scroll bottom:
$('.link_msg').on('click', function() {
$(this).closest('#tabs').find('.messages').each(function() {
$(this).animate({ scrollTop: $(this).prop('scrollHeight')}, 1500);
});
});
I want stop this animation when I scroll mouse. I searched and found a solution but when I give that whith "scroll...":
$('.link_msg').on('click', function() {
$(this).closest('#tabs').find('.messages').each(function() {
$(this).on("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", function(){
$(this).stop();
});
$(this).animate({ scrollTop: $(this).prop('scrollHeight')}, 1500), function(){
$(this).off("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove");
});
return false;
});
});
animation don't started. When I remove "scroll" animation work and stop when I click mouse but of course dont stop when I scroll. How fix this?
How else can animate a scroll to return to the bottom and stopped when i scroll mouse?