在jQuery UI选项卡中设置默认选项卡 [英] Set default tab in jQuery UI Tabs

查看:90
本文介绍了在jQuery UI选项卡中设置默认选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有基本HTML表格的月度日历,每个月都在jQuery UI选项卡中.如何更改默认情况下加载的jQuery UI选项卡?我想使导航中的月份保持顺序,但页面加载时会显示当前月份.

I have a monthly calendar with just basic HTML tables, with each month in a jQuery UI tabs tab. How can I change which jQuery UI tab is loaded by default? I want to keep the months in order in the navigation, but have the current month show on page load.

推荐答案

更新

自从我最初的回答和jQuery 1.9发行以来,API发生了变化.首选方法是使用 redreinard的答案中提到的active选项:

The API has changed since my original answer and the release of jQuery 1.9. The preferred approach is to use the active option as mentioned in redreinard's answer:

$('selector').tabs({ active: index });

旧方法(jQuery 1.9之前的版本)

根据JqueryUI标签上的文档,您可以通过以下方式进行设置使用可用的select函数,如以下两种方法所示:

According to the documentation on the JqueryUI Tabs, you could set this by using the available select function as seen in either the approaches below :

// index will be the index of the tab that you wish to select
$('selector').tabs( "select" , index )
$('selector').tabs({ selected: index });

这篇关于在jQuery UI选项卡中设置默认选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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