Jquery 链接到选项卡中包含的手风琴部分?
我是一个相对较新的网络开发人员,因此,我遇到了我的第一个主要头痛。对,我试图通过锚定标签访问手风琴中的内容,但是手风琴位于一组标签中。锚定标记位于my index.php的页脚内。所有这些功能都由Bootstrap 3方便地提供 基本上,我已经解决了这个问题,并且使用StackOverloow解决了问题中的链接到选项卡的部分,我使用这个脚本完成了这项工作Jquery 链接到选项卡中包含的手风琴部分?,jquery,twitter-bootstrap-3,tabs,accordion,nav,Jquery,Twitter Bootstrap 3,Tabs,Accordion,Nav,我是一个相对较新的网络开发人员,因此,我遇到了我的第一个主要头痛。对,我试图通过锚定标签访问手风琴中的内容,但是手风琴位于一组标签中。锚定标记位于my index.php的页脚内。所有这些功能都由Bootstrap 3方便地提供 基本上,我已经解决了这个问题,并且使用StackOverloow解决了问题中的链接到选项卡的部分,我使用这个脚本完成了这项工作 $(window).load(function() { // cache the id var navbox = $('
$(window).load(function() {
// cache the id
var navbox = $('.nav-tabs');
// activate tab on click
navbox.on('click', 'a', function (e) {
var $this = $(this);
// prevent the Default behavior
e.preventDefault();
// send the hash to the address bar
window.location.hash = $this.attr('href');
// activate the clicked tab
$this.tab('show');
});
// will show tab based on hash
function refreshHash() {
navbox.find('a[href="'+window.location.hash+'"]').tab('show');
}
// show tab if hash changes in address bar
$(window).bind('hashchange', refreshHash);
// read has from address bar and show it
if(window.location.hash) {
// show tab on load
refreshHash();
}