我有一个导航栏,一旦单击该项目,我就会制作动画。我想在导航完成后点击链接。
HTML:
<div id="project-nav">
<ul>
<a href="" >
<li class="project-3">1
<ul>
<li>WAIKANAE BEACH HOUSE</li>
</ul>
</li>
</a>
<a href="">
<li class="project-4">2
<ul>
<li>WAITAHEKE WETLAND HOME</li>
</ul>
</li>
</a>
<a href="">
<li class="project-1">3
<ul>
<li>WAIKANAE BEACH HOUSE</li>
</ul>
</li>
</a>
脚本:
$("#project-nav a").click(function(ev)
{
ev.preventDefault();
var $self=$(this);
$(".project-1").animate( {"top": "+=-500px"}, 1200, function() { showComplete() } );
$(".project-2").animate( {"top": "+=-500px"}, 1400, function() { showComplete() } );
$(".project-3").animate( {"top": "+=-500px"}, 1000, function() { showComplete() } );
$(".project-4").animate( {"top": "+=-500px"}, 1000, function() { showComplete() } );
$(".project-5").animate( {"top": "+=-500px"}, 1000, function() { showComplete() } );
});
function showComplete()
{
document.location = $self.attr('href');
}
这是我到目前为止所拥有的,动画有效,但它没有遵循链接。