使用javascript和animate.css进行onclick

时间:2016-01-16 01:04:56

标签: javascript jquery css onclick animate.css

我不明白为什么这不起作用。

我在我的div类标题上做了一个动画(fadeInDownBig); 我想要的是当我点击一个链接(一个href)时,我的标题就是fadeOutUpBig。



<script>
              	$(function(){
					$("a").click(function(){
						$("#header1").addClass('animated fadeOutUpBig');
					}); 
				});
                        </script>
&#13;
.header{
	margin-left:10px;
	height:350px;
	Background:url(../img/background_header2.jpg);
	background-repeat:no-repeat;
	
}
&#13;
<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>
&#13;
&#13;
&#13;

我做错了什么? (不包括animate.css)

1 个答案:

答案 0 :(得分:0)

与上面提到的评论一样,点击一个锚点会在动画发生之前重定向您。使用javascript,您可以在点击时完成默认操作,最后添加{% for question in stepfieldst.questions|limit:3 %} {% for answer in question.answers|limit:3 %} {% endfor %} {% endfor %} try: stepfieldst = Step.objects.select_related(questions__answers).filter(id = question_id) except Step.DoesNotExist: raise Http404

我使用上面的代码制作了Example

代码:

return false