开发者

How do you make the tab that is selected the default tab for idtabs

I am using the idtabs script from http://www.sunsean.com/idTabs/ and so far they work awesome. However, I am looking for a way to make it so that when the page reloads, the 开发者_运维百科same tab that was selected is still open. So far i'm thinking there must be a way to set the .selected class to assign the default tab. I'm a huge js rookie so any ideas would be greatly appreciated.


You probably need to setup some kind of state persistence in your page so when you refresh the page, the tab you are currently on is not lost.

You could try using cookies like in this example :

http://jqueryui.com/demos/tabs/#cookie

You could also look at this SO post for anotherway to accomplish what you want :

Selecting a jQuery Tab using a parameter in the URL

I suggest you use a library like JQueryUI instead of the first one you come by googling. JQueryUI has more chance to last the test of time.

Good luck.


If you want the page to reload then it doesn't make sense using tabs because you obviously know the action based on which can set the class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜