开发者

jquery tabs in ajax mode change source

开发者 https://www.devze.com 2023-03-04 08:58 出处:网络
I am trying to change a source of a particular jquery tab (ajax mode) I created. I have 5 tabs now so when the user clicks on the second tab after 50 seconds the source url of the iframe needs to chan

I am trying to change a source of a particular jquery tab (ajax mode) I created. I have 5 tabs now so when the user clicks on the second tab after 50 seconds the source url of the iframe needs to change (only once).

I know that I need to use the select code below to determine when the user clicked on the tab but I do not know where to start. Thank you for your help. Any code help would be greatly appreciated.

select: function(event, ui)



 <div id="example">
     <ul>
         <li><a href="ahah_1.html"><span>Content 1</span></a></li>
         <li><a href="ahah_2.html"><span>开发者_开发技巧Content 2</span></a></li>
         <li><a href="ahah_3.html"><span>Content 3</span></a></li>
     </ul>
</div>


Here's how I've done this.

Change the url like so using the built in function. Changing the url in the "a" tag won't do anything, because the link changes when it is bound to the tab layout.:

$("#tabdiv").tabs("url", tabIndex, newLink);

Now the url is updated, but the content stays the same, so refresh the tab like this:

$("#tabdiv").tabs("load", $("#tabdiv").tabs("option","selected"));

Or if you want to switch to another tab just do this:

$("#tabdiv").tabs("load", tabIndex);
0

精彩评论

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