1
我对一些简单的选项卡使用以下代码,并且想知道是否可以编辑此代码以启用深度链接?我没有使用jQuery UI,也不想使用插件。 提前喝彩帮忙。jQuery深度链接
$('#tabber > div').hide(); // Hide all divs
$('#tabber ul li a').click(function() { // When link is clicked
$('#tabber ul li').removeClass('active'); // Remove active class from links
$(this).parent().addClass('active'); //Set parent of clicked link class to active
var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
$('#tabber > div').fadeOut(200); // Hide all divs
$(currentTab).fadeIn(200); // Show div with id equal to variable currentTab
return false;
});
什么是“深度链接”? – Bryan
除了选择活动的3行然后在页面加载时提取哈希段来做同样的事情?(尽管我强烈推荐hashchan ge插件)。 –
url的变化点击,例如:example.com#tab-name和用户可以通过相同的URL获得该标签 – jquerynoob