以下 toggleClass 不起作用:
$nav_item = $ ('.active_wrapper, .main_nav div.arrow_up_img, .main_nav div.arrow_down_img'),
$arrow_down = $ ('.main_nav div.arrow_down_img'),
$arrow_up = $ ('main_nav div.arrow_up_img');
$('.active_wrapper').click(function(e){
e.preventDefault();
$('.main_nav div').not($nav_item).slideToggle('slow', function(){
$(arrow_down).toggleClass($arrow_up);
});
});
HTML
<nav class="main_nav">
<div class="active_wrapper"><a href="#">Home</a>
<div class="arrow_down_img"></div>
</div>
<div><a href="about.php">About Us</a></div>
<div><a href="flavours.php">Flavours</a></div>
<div><a href="stockists.php">Stockists</a></div>
<div><a href="thecollective.php">The collective</a></div>
<div><a href="shop.php">Shop</a></div>
</nav>
toggleClass 用于在 2 个箭头之间交换一个向上和一个向下(您可以想象这是一个下拉菜单),但我真的不知道为什么它不起作用..