我有用於製表符的jQuery代碼,它在單擊選項卡並使用AJAX函數加載內容時運行良好,這是鏈接在HTML代碼中的顯示方式:無法使用單擊觸發器執行代碼jQuery
<ul class="tabset">
<li class="category-all">
<a id="latest-news.all" href="http://www.website.com/#latest-news.all">All</a>
</li>
<li class="category-games">
<a id="latest-news.games" href="http://www.website.com/#latest-news.games">Games</a>
</li>
<li class="category-other">
<a id="latest-news.other" href="http://www.website.com/#latest-news.other">Other</a>
</li>
</ul>
和jQuery的,我只是引用了處理程序:
$(document).ready(function($){
$('ul.tabset li a').on('click', function (e) {
頁面加載時,我嘗試使用URL散列以這種方式打開一個特定的標籤:
if (window.location.hash) {
$(window.location.hash).click();
}
但它不起作用,我已經嘗試了.trigger('click')版本,它也不起作用。
任何幫助真的很感激。