I’ve got a basic little js/jquery function, but I can’t seem to get the animation work for a change to the Body’s “margin-top” – I need the current value of 3em to animate down to 0em. Here’s my function:
$(".notify-close").click(function () {
$('#notify-container').css('display', 'none');
$('body').css("margin-top", "0em");
});
One part I can’t figure out is how to remove pixels (or EM in this case) – for example, here’s an idea regarding adding 50 pixels to a current margin-top, with a “+=50” value, but what’s the REMOVAL equivalent to this in EM? Like “-3EM” ????:
$("body").animate({
margin-top: "+=50"
}, 1500 );
I just used this script – it’s not 100% animated in regards to changing the EM value for the body’s margin-top value, but its a basic fix for now: