我已经看了一些解决方案在这里,但似乎没有工作。基本上,我正在使用一个隐藏的类。我写了Javascript,去除了隐藏的类,并添加了animate.css中的“动画脉冲”类。我怎么能这样做,以便在页面加载3秒之后,JS不会执行该功能?等3秒钟之前功能
<style>
.hidden {
display: none;
}
#gallery {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 3s;
}
</style>
... end head, start body ...
<h2 class="hidden" id="gallery">Testing 123 456 789 Testing</h2>
... skip to bottom ...
<!-- Code that is not working -->
<script>
$("document").ready(function() {
$(this).data('timeout', setTimeout(function() {
$("gallery").removeClass("hidden").addClass("animated pulse");
}, 3000));
});
</script>
围绕setTimeout删除jQuery。使用.data()只是设置HTML元素的数据属性 – Deryck