http://jsbin.com/qafahamugu/1/edit?css,js,outputchangepausedrunningchangeClass.animated{-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:ease-in-out;}.animated2{-webkit-animation-duration:5s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:ease-in-out;}@-webkit-keyframes'blink'{0%{background:rgba(255,0,0,0.5);}50%{background:rgba(255,0,0,0);}100%{background:rgba(255,0,0,0.5);}}.blinksth{width:100px;height:100px;-webkit-animation-name:blink;}var$animated=$(".animated");$(".change").on("click",function(){$animated.css({"webkitAnimationDuration":"10s"});});$(".paused").on("click",function(){$animated.css({"webkitAnimationPlayState":"paused"});});$(".running").on("click",function(){$animated.css({"webkitAnimationPlayState":"running"});});$(".change-class").on("click",function(){$(".blinksth").removeClass("animated").addClass("animated2");});嘗試了直接修改時(shí)間和切換類(lèi)名的辦法,有什么正確的推薦做法嗎
CSS animation,用 JS 修改 duration 無(wú)效
慕妹3146593
2019-04-16 20:27:28