I have a jquery function, first(), which I have running on page load to do a carousel of images. When the user scrolls down, I want the function to pause - and ideally, but not necessarily - to resume when you scroll back to the top of the page.
I've tried various things, including:
$(document).ready(function first(){
etc
});
$(window).scroll(function(){
if ($(window).scrollTop()==0){
first()
}
else {
second()
}
});
Where second() just displays one image (call it A) in the carousel. But that just inserts image A into the sequence until the next carousel transition - presumably because I have first() running from page load and it's not stopping. How can I pause it? Thanks!