【发布时间】:2015-11-23 04:54:29
【问题描述】:
您好,我已经找到了这个话题:jQuery tabs: how to create a link to a specific tab?
但这并不能解决我的问题,
这里是我的代码:
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
e.preventDefault();
yInitPos = $(window).scrollTop();
// On ajoute le hash dans l'url.
window.location.hash = $(this).attr("href");
return false;
});
});
我无法访问带有这样链接的标签:http://127.0.0.1/admin.php#tab2
你能帮帮我吗?谢谢
【问题讨论】:
-
你知道我们不能点击那个链接,对吧?
-
链接问题中的答案如何没有帮助?它在这里包含解决方案 -
var activeTab = $(this).find("a").attr("href"); $(activeTab).show(); -
在上面的代码中,您没有使用您引用的主题的“解决方案”......这可能会有所帮助。
-
同时提供您的 html 代码,以便我们快速提供帮助
-
我刚做完,先谢谢了。
标签: javascript php jquery url hyperlink