简体   繁体   English

jQuery UI选项卡,将标签设置为被动和主动

[英]jQuery UI Tab, set tab passive and active

I've 3 tabs. 我有3个标签。 I want to set tab1 active and set another tabs passive. 我想将tab1设置为活动状态并将其他选项卡设置为被动。 Only on first page load, It must be like that. 只有在第一页加载时,它必须是这样的。

 <div id="tabs">
        <ul>
            <li><a href="#tabs-1">first</a></li>
            <li><a href="#tabs-2">second</a></li>
            <li><a href="#tabs-3">third</a></li>
        </ul>
        <div id="tabs-1">
        ...

Disable a tab. 禁用选项卡。 The selected tab cannot be disabled. 无法禁用所选选项卡。 To disable more than one tab at once use: 要一次禁用多个选项卡,请使用:

$('#example').tabs("option","disabled", [1, 2, 3]);

The second argument is the zero-based index of the tab to be disabled. 第二个参数是要禁用的选项卡的从零开始的索引。 Instead of an index, the href of the tab may be passed. 可以传递选项卡的href而不是索引。

http://jqueryui.com/demos/tabs/#method-disable http://jqueryui.com/demos/tabs/#method-disable

You could probably trigger a click event on the first tab on DOMReady. 您可以在DOMReady的第一个选项卡上触发单击事件。 Something like: 就像是:

$("#tabs ul li:first-child a").click();

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

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