手动激活标签 jquery ui 1.10.3 [英] Manually activate tabs jquery ui 1.10.3
问题描述
我真的很生气,我搜索了 jquery ui doc 和 stackoverflow 的问题(大量问题),但我不知道如何手动激活标签(.tabs()
) 在 jquery 1.10+ 中.
I am really getting mad, I searched through jquery ui doc and stackoverflow's questions (tons of questions) but I cannot figure out how to manually activate tabs ( .tabs()
) in jquery 1.10+ .
我创建并尝试了这个解决方案:
I founded and tried this solution :
$(mytabs).tabs("option", "active", index);
但它似乎没有成功.有人可以帮我知道如何激活标签,例如当我 create
一个新的?
but it does not seem to work out. Can someone help me to know how to activate a tab , e.g. when I create
a new one?
我无法弄清楚 jQuery UI 是如何不再有 select
事件的,据我所知,该事件实现了这个目标.
I can't figure out how jQuery UI has no longer the select
event that , as I could know, accomplished this goal.
我正在用这个 function
创建新的 tabs
:
I'm creating new tabs
with this function
:
var addTab = function() {
var tabTemplate = "<li><a href='#tabs-1'>non titolato</a></li>";
var li = $.parseHTML(tabTemplate);
$(li).addClass('ui-corner-all');
$(".ui-tabs-nav").append(li);
$("#stepBuilder").tabs('refresh');
}
我想激活最后一个创建的.
I would like to activate the last one that was created.
推荐答案
使用以下来激活最后一个选项卡.
Use the following to activate the last tab.
$("#stepBuilder").tabs({ active: -1 });
我在 jsfiddle.net 上为您创建了 一个示例.
I've created an example for you on jsfiddle.net.
API 文档提到了 activate
选项:
活动
类型:布尔值或整数默认值:0
Type: Boolean or Integer Default: 0
当前打开的是哪个面板.
Which panel is currently open.
支持多种类型:
布尔值:将 active 设置为 false 将折叠所有面板.这要求可折叠选项为真.
Boolean: Setting active to false will collapse all panels. This requires the collapsible option to be true.
整数:活动(打开)面板的从零开始的索引.负值选择从最后一个向后退的面板面板.
Integer: The zero-based index of the panel that is active (open). A negative value selects panels going backward from the last panel.
这篇关于手动激活标签 jquery ui 1.10.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!