1
這是我爲CSS3動畫編寫的代碼:我在其中一個導航鏈接上應用了搖動。它的作用就像是一種魅力,但我希望當有人打開鏈接到它的頁面時,它就會關閉。僅在特定頁面上使用CSS3動畫
我該如何解決這個問題?
#menu-item-313 {
animation: shake 1.4s;
-webkit-animation-iteration-count: 10; /* Chrome, Safari, Opera */
animation-iteration-count: 6;
transform: translate3d(0, 0, 0);
}
@keyframes shake {
10%, 90% {
transform: translate3d(-2px, 0, 0);
}
20%, 80% {
transform: translate3d(4px, 0, 0);
}
30%, 50%, 70% {
transform: translate3d(-8px, 0, 0);
}
40%, 60% {
transform: translate3d(8px, 0, 0);
}
}
不能切實用CSS或HTML單獨做到這一點,你需要實現某種邏輯上這一切之上。例如,它可能是一些基於當前URL的JavaScript將CSS類添加到禁用動畫的'body'元素。 – damd
您能否提供您的HTML並將片段更新爲工作片段,以便我們更好地理解目標是什麼? – somethinghere