如何通過(guò)一個(gè)事件(hover,click..)觸發(fā)css3動(dòng)畫的重新執(zhí)行?在stackoverflow找到一個(gè)相關(guān)的問(wèn)題,但是下面給出的答案也不起作用。http://jsfiddle.net/arunpjohny/8WQcy/1/這篇文章挺好的,介紹了重新運(yùn)行css3動(dòng)畫的不同方法animation必須是infinite,animation-play-state才有效。restart用這種方法挺好://retrievetheelementelement=document.getElementById("logo");//resetthetransitionby...element.addEventListener("click",function(e){e.preventDefault;//->removingtheclasselement.classList.remove("run-animation");//->triggeringreflow/*Theactualmagic*///withoutthisitwouldn'twork.Tryuncommentingthelineandthetransitionwon'tberetriggered.element.offsetWidth=element.offsetWidth;//->andre-addingtheclasselement.classList.add("run-animation");},false);
如何重新運(yùn)行css3的動(dòng)畫?
瀟瀟雨雨
2019-04-10 20:47:45