启用禁用jquery选项卡
|
我有一个jQuery选项卡容器,其中有两个选项卡。现在我想要的是最初禁用第二个选项卡。单击第一个选项卡上的按钮后,第二个选项卡将启用并自动打开。
<script type=\"text/javascript\">
$(document).ready(function() {
//When page loads...
$(\".tab_content\").hide(); //Hide all content
$(\"ul.tabs li:first\").addClass(\"active\").show(); //Activate first tab
$(\".tab_content:first\").show(); //Show first tab content
//On Click Event
$(\"ul.tabs li\").click(function() {
$(\"ul.tabs li\").removeClass(\"active\"); //Remove any \"active\" class
$(this).addClass(\"active\"); //Add \"active\" class to selected tab
$(\".tab_content\").hide(); //Hide all tab content
var activeTab = $(this).find(\"a\").attr(\"href\"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
</script>
<div class=\"tab-wrapper\" id=\"tab-wrapper\">
<div class=\"tab-header\">
<ul class=\"tabs\">
<li><a href=\"#tab1\">overview</a></li>
<li><a href=\"#tab2\">details</a></li>
</ul>
</div>
<div class=\"tab_container\">
<div id=\"tab1\" class=\"tab_content\">
here is the list of the overview
</div>
<div id=\"tab2\" class=\"tab_content\">
Particular Details
</div>
</div>
</div>
没有找到相关结果
已邀请:
4 个回复
素汞读
拟僚疽刊剔
并使用零索引数字选择禁用的数字。要启用标签,您可以使用以下方法:
要设置选定的标签,可以使用jQuery Tabs中的以下示例:
需复
不起作用。因此,我建立了自己的功能来全部禁用它们。在这里是:
您可以像这样使用它:
。 jQuery不允许您禁用当前选项卡-由于这将在页面加载中进行,因此它将是第一个。然后,您将需要创建一些变量来存储一些数据...
然后,有几个函数来处理它...
然后,我们只附加一些事件处理程序:
这些按钮的HTML非常简单:
希望这会有所帮助-祝你好运! 顺便说一句:我在这里有一些完整的工作选项卡,您可能想看看。
闯舱酮
并给id给li> a: