How can I edit this to run only once after user scroll up:
(function () {
var previousScroll = 0;
$(window).scroll(function(){
var currentScroll = $(this).scrollTop();
if (currentScroll < previousScroll){
alert('up');
}
previousScroll = currentScroll;
});
}()); //run this anonymous function immediately
if you want the user to be notified only once, then you could just use a boolean to keep track whether the notice is done.
Also note the change in the last line. Use the self-executing anonymous function properly as