How do I animate a scale css property using jquery?

前端 未结 5 695
难免孤独
难免孤独 2020-12-20 10:47

I am trying to have a circle div with the class of \"bubble\" to pop when a button is clicked using jQuery. I want to get it to appear from nothing and grow to its full size

5条回答
  •  感动是毒
    2020-12-20 11:35

    Better go with CSS3 Animations. For animation at a frequent interval you can use with browser supporting prefixes(-webkit,-moz,etc.)-

    @keyframes fullScale{
        from{
            transform:scale(0);
        }
        to{
            transform:scale(1);
        }
    }
    .bubble:hover{
        animation: fullScale 5s;
    }
    

    Refer this link- http://www.w3schools.com/css/css3_animations.asp

    Or the above solution by @Rory is also a good way to addclass on an attached event.

提交回复
热议问题