I'm trying to have an animation play whilst the user is scrolling and stop when they stop.
I know very little javascript, but from hunting around and adapting I've got as far as making it start on scrolling, but then it keeps going and I can't figure out how to make it stop as soon as the scrolling ends.
Here's what I have so far:
$(window).scroll(function() {
$('#square').animate({
top: '70px',
queue: true,
}, 900).animate({
top: '5px',
queue: true
}, 1000);
});
Any help greatly appreciated!