I got to animate a div when $('body').scrollTop() > 45
I need animate the same div when the user scrolls up. I tried this code, the first if works. How can I get the second conditional to work?
if ($('body').scrollTop() > 45) {
$('.my-div').animate({
top:'-45px'
}, 200);
}
if (¿?user-scrolls-up¿?) {
$('.my-div').animate({
top:'0px'
}, 200);
}