我在wordpress博客的側欄上有一個標籤導航框。點擊標籤進行導航時,頁面跳轉到頂部。Jquery returnfalse;不工作
該代碼具有返回false並且還嘗試了href =#onclick = returnfalse;但它不起作用。
謝謝!(如果你指出在代碼中的錯誤會理解爲我完全的菜鳥用jQuery)
$(document).ready(function(){
$('ul.tabNav a').click(function() {
var curChildIndex = $(this).parent().prevAll().length + 1;
$(this).parent().parent().children('.current').removeClass('current');
$(this).parent().addClass('current');
$(this).parent().parent().next('.tabContainer').children('.current').show('fast',function() {
$(this).removeClass('current');
$(this).parent().children('div:nth-child('+curChildIndex+')').hide('fast',function() {
$(this).addClass('current');
});
});
return false;
});
});
呵呵,差不多相同的片段... – 2012-03-27 08:55:54
以秒爲單位打我; p – 2012-03-27 08:57:58
謝謝大家!我之前嘗試過,它在一個「測試文件」上工作,但當我將代碼遷移到我的WordPress主題時,問題仍然存在... – user1044994 2012-03-27 09:02:15