如何创建jquery选项卡,当页面回发时,标签不会更改? [英] How to create jquery tab that when page post back, tabs don't change?
本文介绍了如何创建jquery选项卡,当页面回发时,标签不会更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此地址的标签源代码: http://jqueryui.com/tabs/ [ ^ ]
但我的问题是:例如,当我在第二个标签部分并点击一个按钮并且页面回发后,页面转到第一个标签部分。
如何解决这个问题?
Hi,
I use source code for tab from this address: http://jqueryui.com/tabs/[^]
but my problem is: for example when I am in second tab section and click on a button and page is post back, the page go to first tab section.
how to solve this problem?
推荐答案
这个SO帖子有几个答案:
http://stackoverflow.com/questions/14313270/jquery-ui-tabs-no-longer-supporting-cookie-now-what [<一个href =http://stackoverflow.com/questions/14313270/jquery-ui-tabs-no-longer-supporting-cookie-now-whattarget =_ blanktitle =New Window> ^ ]
您需要在请求之间存储活动选项卡。最简单的解决方案是使用cookie。
添加 jQuery cookie插件 [ ^ ] (不是必需的,但是它使得操作cookie变得更加容易)。然后修改创建选项卡的脚本:
There are several answers in this SO thread:
http://stackoverflow.com/questions/14313270/jquery-ui-tabs-no-longer-supporting-cookie-now-what[^]
You need to store the active tab between requests. The simplest solution is to use a cookie.
Add the jQuery cookie plugin[^] (not required, but it makes manipulating cookies a lot easier). Then modify the script that creates the tabs:
( 。selector)。tabs({
active:
( ".selector" ).tabs({ active :
.cookie(' activetab'),
激活: function (事件,ui){
.cookie('activetab'), activate : function( event, ui ){
这篇关于如何创建jquery选项卡,当页面回发时,标签不会更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文