Reputation: 3137
I have following code. on Scroll height is working, but margin-top is not working. Any idea how to resolve this issue
$(document).scroll(function(){
if ($(this).scrollTop()>300){
// animate fixed div to small size:
$('.secHead a.views').animate({marginTop:"-14px"});
$('.listTrigger').stop().animate({ height: 45 });
} else {
// animate fixed div to original size
$('.listTrigger').stop().animate({ height: 82 });
}
});
Thanks
Upvotes: 0
Views: 41
Reputation: 492
First be sure that your element with margin-top: -14px works fine.
Then, try replacing this:
$('.secHead a.views').animate({marginTop:"-14px"});
By this:
$('.secHead a.views').animate({'margin-top:"-14px"});
Upvotes: 1