当我将 class 更改为 JavaScript 时,为什么 CSS 没有动画?
Why doesn't the CSS animate when I change the class with JavaScript?
我正在使用从 here 下载的来自 Daniel Eden 的 Animate.css。我可以通过在我想要设置动画的项目上使用 animated (typeOfAnimation)
class 来设置我网站上的动画。
这是我的 HTML
:
<button onmouseover = "makeEnglishPulse()" id = "english" class = "animated bounceInRight">// English</button>
这是我的 JavaScript
:
function makeEnglishPulse() {
document.getElementById("english").class = "animated pulse";
}
加载我的网站后,我的按钮确实弹跳了,但是为什么即使我正在更改 class,但当我用鼠标移动时它没有跳动?
对于任何解决方案,我只想留下 JavaScript
或 HTML
!
谢谢!
要设置的属性是.className
,不是.class
。
function makeEnglishPulse() {
document.getElementById("english").className = "animated pulse";
}
我正在使用从 here 下载的来自 Daniel Eden 的 Animate.css。我可以通过在我想要设置动画的项目上使用 animated (typeOfAnimation)
class 来设置我网站上的动画。
这是我的 HTML
:
<button onmouseover = "makeEnglishPulse()" id = "english" class = "animated bounceInRight">// English</button>
这是我的 JavaScript
:
function makeEnglishPulse() {
document.getElementById("english").class = "animated pulse";
}
加载我的网站后,我的按钮确实弹跳了,但是为什么即使我正在更改 class,但当我用鼠标移动时它没有跳动?
对于任何解决方案,我只想留下 JavaScript
或 HTML
!
谢谢!
要设置的属性是.className
,不是.class
。
function makeEnglishPulse() {
document.getElementById("english").className = "animated pulse";
}