jQuery Animate Padding to Zero

前端 未结 4 1479
温柔的废话
温柔的废话 2021-01-11 09:14

I have the following snippet that toggles padding when hovering (see example here):

4条回答
  •  北海茫月
    2021-01-11 10:15

    I just realized jquery is not reacting very well to hyphens "-" within animation but you get the same result by getting ride of the hyphen and capitalizing the first letter after. So for you will have something like this:

        $("#inner").mouseleave(function () {
           $("#outer").animate({
         paddingTop : 0,
             paddingRight : 0,
             paddingBottom : 0,
             paddingLeft : 0,
             borderLeftWidth: 0,
             borderTopWidth: 0,
             borderRightWidth: 0,
             borderBottomWidth: 0,
    
     }, slow);
    

提交回复
热议问题