记住刷新后哪个选项卡处于活动状态 [英] Remember which tab was active after refresh
问题描述
我在网页上使用jquery选项卡,刷新页面时,它会丢失我以前使用过的所有选项卡,并返回到第一个选项卡.
有人遇到过这个问题,知道如何解决吗?
我假设您正在使用jQuery UI标签,
下面是一个使用标签+ cookie来保存最后点击的标签的示例
http://jqueryui.com/demos/tabs/#cookie >
演示: 打开这个链接 http://jqueryui.com/demos/tabs/cookie.html
将其关闭并重新打开,您将看到相同的单击选项卡
更新: 经过三年的回答,jQuery ui已弃用cookie选项: http://jqueryui.com/upgrade-guide/1.9/#deprecated-cookie-option .
,但如果这符合您的需求,您仍然可以在这里追加看看 https://stackoverflow.com/a/14313315 /109217
I'm using jquery tabs on a web page and when the page is refreshed it loses what ever tab I had been on and goes back to the first tab.
Has anyone come across this problem and know how to solve it?
I assume that you are using jQuery UI tabs ,
here is an example of using tabs + cookies to save the last clicked tab
http://jqueryui.com/demos/tabs/#cookie
demo : open this link http://jqueryui.com/demos/tabs/cookie.html
the close it and re open it and you will see the same clicked tab
update: after 3 years of this answer jquery ui has deprecated the cookie option : http://jqueryui.com/upgrade-guide/1.9/#deprecated-cookie-option.
but you can still append take a look here if this fits your needs or not https://stackoverflow.com/a/14313315/109217
这篇关于记住刷新后哪个选项卡处于活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!