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-开发者_C百科top, with a "+=50" value, but what's the REMOVAL equivalent to this in EM? Like "-3EM" ????:
$("body").animate({
    margin-top: "+=50"
  }, 1500 );
Did you try this?
$("body").animate({
    margin-top: "-=50em"
}, 1500 );
$("body").animate({
    margin-top: "50px"
  }, 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:
<script>
    $(".notify-close").click(function () {
        $('#notify-container').css('display', 'none');
        $('body').css("margin-top", "0");
    });         
</script>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论