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

查看:40
本文介绍了在 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天全站免登陆