jQuery animate() on body tag

Hey all,

I’ve got this quick script here that’s supposed to animate the body margin attribute:

$(document).ready(
			
			function() {
				
				$("#copyright").hover(function() {
					$("body").animate({ margin: "0px 274px 0px 0px" }, 1500 );
				}, function() {
					$("body").animate({ margin: "0px" }, 1500 );
				});
			
			}
										
		);

However, when I hover over #copyright, the body just jumps to those margins, rather than animating. Any help?

Try the following:


$(document).ready(function() {
	$("#copyright").hover(function() {
		$("body").animate({ marginTop: '0', marginRight: '274px', marginBottom: '0', marginLeft: '0' }, 1500 );
	}, function () {
		$("body").animate({ marginRight: '0' }, 1500 );
	});
});

Although, you may just need the following:


$(document).ready(function() {
	$("#copyright").hover(function() {
		$("body").animate({ marginRight: '274px' }, 1500 );
	}, function () {
		$("body").animate({ marginRight: '0' }, 1500 );
	});
});

That seemed to do the the trick. Thank you much!