onclick with javascript and animate.css
onclick with javascript and animate.css
我不明白为什么这不起作用。
我在div 类标题上做了一个动画(fadeInDownBig);我想要的是当我点击一个链接(一个href)时,我的标题确实淡出OutUpBig。
<script>
$(function(){
$("a").click(function(){
$("#header1").addClass('animated fadeOutUpBig');
});
});
</script>
.header{
margin-left:10px;
height:350px;
Background:url(../img/background_header2.jpg);
background-repeat:no-repeat;
}
<div class="header animated fadeInDownBig" id="header1" >
<div class="menu">
<a class="wow animated fadeIn hvr-grow-shadow transition" data-wow-delay="0.5s" href="../index.html" >Home </a>
我做错了什么?(不包括动画.css)
就像上面提到的评论一样,单击锚点将在动画发生之前重定向您。使用 javascript,您可以通过在末尾添加return false
或preventDefault
来使其在单击时根本不执行其默认操作。
我用上面的代码做了一个示例。
法典:
$(function() {
$("a").click(function() {
$("#header").addClass('animated fadeOutUpBig');
return false;
});
});
相关文章:
- 关于使用Animate.css向和项添加和删除动画类的问题
- 添加animate.css类,然后使用remove移除元素
- jQuery+Animate.css动画只工作一次,动画不会重置
- 使用 Animate.css 时切换动画
- Angular 和 Animate.css - 一起使用时不显示正确的信息
- AngularJS ngAnimate and animate.css
- Jquery/animate.css 侧边菜单在多次切换时消失
- Animate CSS Flip上的双面图像
- 具有 animate.css 和 jquery 的顺序动画
- onclick with javascript and animate.css
- onload add class animate.css
- wowjs/animate.css和隐藏元素
- animate.css:悬停脚本动画
- 严重被WOW.js难住,并与animate.css融合
- transform rotate()不适用于Animate.css
- 使用Animate.css链接弹跳入口/出口
- 如何添加在animate.css中编码的css动画循环之间的间隔
- 路径点,animate.css和滚动的不透明度问题
- 使用Angular 1.2和Animate.css加载动画
- ng-animate not working with animate.css