作者:爱在西元前2502938591 | 来源:互联网 | 2023-02-05 14:23
如何刷新或重新访问页面时,如何让浏览器记住用户正在查看哪个选项卡?
-
Home
档案信息设置
472084..
7
这对我有用了..
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var hash = $(e.target).attr('href');
if (history.pushState) {
history.pushState(null, null, hash);
} else {
location.hash = hash;
}
});
var hash = window.location.hash;
if (hash) {
$('.nav-link[href="' + hash + '"]').tab('show');
}
使用URL哈希创建可共享链接.
1> 472084..:
这对我有用了..
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var hash = $(e.target).attr('href');
if (history.pushState) {
history.pushState(null, null, hash);
} else {
location.hash = hash;
}
});
var hash = window.location.hash;
if (hash) {
$('.nav-link[href="' + hash + '"]').tab('show');
}
使用URL哈希创建可共享链接.