- function addTab(title, url){
- if ($('#tt').tabs('exists', title)){
- $('#tt').tabs('select', title);
- } else {
- $('#tt').tabs('add',{
- title:title,
- href:url, //tab中显示的内容
- closable:true
- });
- }
- }
第二种以iframe的方式:
- function addTab(title, url){
- if ($('#tt').tabs('exists', title)){
- $('#tt').tabs('select', title);
- } else {
- var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
- $('#tt').tabs('add',{
- title:title,
- content:content, //tab中显示的内容
- closable:true
- });
- }
- }
想要实现点击tab内容中的链接,在父级中tab上新增一个tab的话,须以iframe方式来添加父级tab。
在tab内容中,即url页面中,需要在链接上实现下面这个方法: