简体   繁体   中英

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. 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.

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/

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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