I have a fixed div that I have placed to the right: -35px. I want it to come right: 0px once one scrolls past 350px. I have the jquery code below
$(window).scroll(function() {
var height = $(window).scrollTop();
if(height > 350) {
$("#MySideDiv").animate({ "right": 0 }, "slow")
}
else{
$("#MySideDiv").animate({ "right": -55 }, "slow")
}
});
This only works well when I don't include the else bit. Yet I want it to disappear if the user scrolls back to less then 350px. Is there a way to achieve this?