简体   繁体   中英

Animate Spin SVG Element with JQuery

I want to animate the transformation of this SVG element. I wish this worked:

$(this).find('polygon').animate({
    transform: "rotate(360)"
}, 5000);

Check this JSFiddle i made for you. You could add an extra class and put the animation on that extra class.

.chevron.rotate {
    -ms-transform: rotate(360deg); /* IE 9 */
    -webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
    transform: rotate(360deg);
}

and then do this in your javascript:

$('.rotate-btn').on('click', function() {
    $('.chevron').addClass('rotate');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM