I need to differentiate between a scroll the code does and a scroll the user does. This is what I'm trying to do:
window.auto_scrolling = true;
$('html, body').animate({
scrollTop: $(document).height()-$(window).height()},
{duration: 500, easing: 'swing', done: function(e) {
window.auto_scrolling = false;
}}
);
However, despite being set to false in the done function, window.auto_scrolling is false in the last event caught by the $(window).scroll event handler.
Here's a JS fiddle showing my problem: http://jsfiddle.net/uLq9X/