简体   繁体   English

从zurb基础选项卡中删除活动的类

[英]Remove active class from zurb foundation tabs

I am using foundation tabs on part of a web application, however the default desired behavior is for all the tabs on the document to be closed. 我在Web应用程序的一部分上使用基础选项卡,但是默认的期望行为是要关闭文档上的所有选项卡。 However I cannot get the tabs to initialize in this manner. 但是我无法以这种方式初始化选项卡。

Since I did not find an option for this I am trying to remove the active class from all the tabs on the page that match the below selector. 由于我没有找到用于此目的的选项,因此我尝试从页面上与以下选择器匹配的所有选项卡中删除活动类。

However the remove of the class is occurring before the class is applied by Foundation. 但是,该类的删除是在Foundation应用该类之前进行的。

How can I remove the active class after it is added, or alternatively how can I not have it add the active class in the first place? 添加活动类后如何删除活动类,或者首先如何不让它添加活动类?

$(document).foundation();
$(window).load(function(){
  alert("in load");
  $('.contextDropDown p').parent().each(function(){
    alert("im here");
   $(this).removeClass("active");});
});

http://jsbin.com/olidux/1/ http://jsbin.com/olidux/1/

Assuming Foundation 4, at the time of this post beginning on line 180 of the foundation.section.js file you'll see the following lines: 假设使用Foundation 4,在这篇文章开始于foundation.section.js文件的第180行时,您将看到以下几行:

if (settings.one_up || !self.small($this)) {
    first.addClass('active');
}

Comment out these lines (the second one specifically) to prevent the first tab being initialized with the active class. 注释掉这些行(特别是第二行),以防止第一个选项卡被活动类初始化。

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

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