我有一個菜單,通過單擊鏈接來切換。我希望鏈接在菜單可見時加下劃線,並且在隱藏時沒有裝飾。我無法獲得正確的功能:當您第一次按下觸發按鈕時會顯示下劃線,但在隱藏菜單後仍會顯示下劃線。jQuery切換下劃線
感謝您的幫助!
HTML
<div id="trigger">
<div id="menu">MENU<br/></div>
<div id="navdrop">
<a class="a transition" id="item1" href="Pages/music.html" alt="MUSIC">MUSIC</a><br />
<a class="a transition" id="item2" href="Pages/photos.html" alt="PHOTOS">PHOTOS</a><br />
<a class="a transition" id="item3" href="Pages/biography.html" alt="BIOGRAPHY">BIOGRAPHY</a><br />
<a class="a transition" id="item4" href="Pages/discography.html" alt="DISCOGRAPHY">DISCOGRAPHY</a><br />
<a class="a transition" id="item5" href="Pages/contact.html" alt="CONTACT">CONTACT</a><br />
<a class="a" id="item6" href="http://www.blog.fernandogaribay.com" alt="BLOG" target="_blank">BLOG</a><br />
</div>
</div>
的Javascript
$('#trigger').click(function(){
$('#navdrop').slideToggle(400);
$('#menu').css("text-decoration", "underline");
});
這仍然將切換在幻燈片完成之前的課程 – jondavidjohn 2011-01-13 05:16:10