2009-10-17 94 views
0

我不知道我在做什麼,但是我發現了一些代碼,我正在使用它在我的博客上爲幫助頁面創建手風琴下拉菜單。 一切都很完美,但是當我點擊下拉菜單中的鏈接時,它會關閉手風琴並且不會進入外部網站。我不知道我做錯了什麼。有沒有辦法來解決這個問題?jQuery手風琴鏈接不起作用

這裏是我使用的代碼...

jQuery(function() { 
    jQuery("li.profile a").click(function(e) { 
    jQuery(e.target).closest("li").find("p").toggle(); 
    return false; 
    }) 

});

這是HTML ...

<ul > 
    <li class="profile"> 
     <a href="#">Section 1</a> 
     <p style="display: none;"> 
     <a href="www.google.com">Click here</a> Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer 
    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit 
    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut 
    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate. 
     </p> 
    </li> 
</ul> 

如果有此一修正,請啞下來了我,所以我會明白我需要做的。 在此先感謝!

回答

0
jQuery(function() { 
    jQuery("li.profile > a").click(function(e) { 
    jQuery(e.target).closest("li").find("p").toggle(); 
    return false; 
    }) 
}); 
+0

非常感謝你! – Stacie 2009-10-17 05:40:39