300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > bootstrap切换tab页局部刷新_bootstrap在 刷新页面 tab选择页面不会改变。

bootstrap切换tab页局部刷新_bootstrap在 刷新页面 tab选择页面不会改变。

时间:2023-12-18 15:37:44

相关推荐

bootstrap切换tab页局部刷新_bootstrap在 刷新页面 tab选择页面不会改变。

您可以直接复制代码 注意在同级别文件夹中引用 相应js 和 css。

实现tab影响 关键看bootstrap的 data-toggle= tab

$(document).ready(function() {

if(location.hash) {

$('a[href=' + location.hash + ']').tab('show');

}

$(document.body).on("click", "a[data-toggle]", function(event) {

location.hash = this.getAttribute("href");

});

});

$(window).on('popstate', function() {

var anchor = location.hash || $("a[data-toggle=tab]").first().attr("href");

$('a[href=' + anchor + ']').tab('show');

});

HomeProfileMessagesSettingshomeprofilemessagessettings

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。