通过单击选项卡之外的链接来设置活动选项卡? [英] Set active tab by clicking a link thats outside of the tabs?

查看:87
本文介绍了通过单击选项卡之外的链接来设置活动选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI选项卡: http://api.jqueryui.com/tabs/

Im using the jQuery UI Tabs: http://api.jqueryui.com/tabs/

如何在我的页面上的标签之外建立链接,单击该链接以使某个标签处于活动状态?谢谢

How can I make a link on my page thats outside of the tabs, when clicked make a certain tab active? Thanks

推荐答案

请参见 http://api.jqueryui.com/tabs/#option-active

要获取当前的活动标签索引,请执行以下操作:

To get current active tab index:

var currentActive = $( ".selector" ).tabs( "option", "active" );

要设置当前的活动标签,请执行以下操作:

To set current active tab:

$( ".selector" ).tabs( "option", "active", <number of tab> );

例如:

$('a').click(function(){
         $( ".tabs" ).tabs( "option", "active", 2 );
});

这篇关于通过单击选项卡之外的链接来设置活动选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆