Animate Not Working on Scrool
Can you please take a look at
this demo and let me know why the second part of targeting the scroll position is not working? what I want to do is targeting scrool postion between 450 to 600 and applying this animation
- $(".box-caption").animate({ "top": "600px" },1000);
to the element
- $(function() {
$( window ).scroll(function(e) {
var y = $( window ).scrollTop();
if (y >200 && y< 400){
$(".box-caption").animate({ "top": "350px" },1000);
}
if (y >450 && y< 600){
$(".box-caption").animate({ "top": "600px" },1000);
}
});
});
as you can see it is working on first animate but not working for second! can you please let me know why this is happening and how I can fix it? thanks