简体   繁体   English

手动激活标签jquery ui 1.10.3

[英]Manually activate tabs jquery ui 1.10.3

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+ . 我真的生气了,我搜索了jquery ui doc和stackoverflow的问题(大量问题),但我无法弄清楚如何在jquery 1.10+中手动激活标签.tabs() )。

I founded and tried this solution : 我创建并尝试了这个解决方案:

$(mytabs).tabs("option", "active", index);

but it does not seem to work out. 但它似乎没有成功。 Can someone help me to know how to activate a tab , eg when I create a new one? 有人可以帮助我知道如何激活选项卡,例如当我create一个新选项卡时?

I can't figure out how jQuery UI has no longer the select event that , as I could know, accomplished this goal. 我无法弄清楚jQuery UI如何不再是我所知道的完成此目标的select事件。

I'm creating new tabs with this function : 我正在使用此function创建新tabs

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 });

I've created an example for you on jsfiddle.net . 在jsfiddle.net上为你创建了一个例子

The API doc says about the activate option: API文档说明了activate选项:

active

Type: Boolean or Integer Default: 0 类型:布尔值或整数默认值:0

Which panel is currently open. 哪个面板目前是开放的。

Multiple types supported: 支持多种类型:

Boolean: Setting active to false will collapse all panels. Boolean:将active设置为false将折叠所有面板。 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. 负值选择从最后一个面板向后移动的面板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM