我有小问题。我有一个包含三个菜单项和页面的菜单
首页 - 产品 - 产品和它还包含选项卡内容1tab是“公司信息”,第二个选项卡是“联系我们” 联系我们 - 这不是一个页面,而是链接到产品页面上的第二个标签
我想知道有没有办法,当点击“联系我们”时,请转到产品页面的第二个标签
答案 0 :(得分:1)
我希望你在谈论某种jQuery标签,在这种情况下你可以做类似
的事情<a href="index.php#contact-us">Contact Us</a>
// get the hash from the location
var tab = window.location.hash;
// get the <a> element with the href that matches the location hash,
// and fire a click event on it
$('div.tabs ul.tabNavigation a[href=' + tab + ']').click();
注意:标签ID应与哈希
匹配