我有一个 jquery 切换,我需要用 3 个单独的触发器来触发。我发现了这个: jQuery toggle single div with two different triggers
...但我需要切换到特定高度的动画。这是我当前的代码:
<script type='text/javascript'>
$(function(){
$(".nav-toggle").toggle(function(){
$("#main-nav-dropdown").animate({height:146},500);
},function(){
$("#main-nav-dropdown").animate({height:20},500);
});
});
</script>
和html
<div id="main-nav-dropdown">
<div class="capsule">
<nav id="main-nav">
<ul>
<li><span class="nav-toggle">1</span>
</li>
<li><span class="nav-toggle">2</span>
</li>
<li><span class="nav-toggle">3</span>
</li>
<li class="last"><a href="">4</a></li>
</ul>
</nav>
</div>
</div>
任何帮助,将不胜感激。谢谢你。