How do I automatically .scrollTo()
(using a plugin) when scrolling manually between two y positions? (if()
statement inside .scroll()
)
The code I have below, seems pretty straightforward. However, the scrolling is a bit bumpy and when it has scrolled automatically to the content, the scrolling is stuck there. As if it wants to do two things.
scrollToContent = function() {
$(document).stop(1, 1).scrollTo($('.content'), 750, { easing: 'easeInOutQuint' });
}
$(window).scroll(function() {
if ($(this).scrollTop() <= $(this).height()) {
scrollToContent();
}
});