jellekralt / Responsive-Tabs

Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.
http://jellekralt.github.io/Responsive-Tabs/
MIT License
531 stars 228 forks source link

Why is first tab showing active state by default? #115

Closed MikeiLL closed 7 years ago

MikeiLL commented 7 years ago

Using the following hack so that the first tab doesn't have the r-tabs-state-active class.

But it seems like it shouldn't be showing as active with startCollapsed: 'true'.

jQuery(document).ready(function ($) {
  if ($('#responsiveTabsFooter')) {
  $('#responsiveTabsFooter').responsiveTabs({
      startCollapsed: 'true',
      disabled: [1,2],
      animation: 'slide',
      click: function(event, tab){
        if (tab.id === 1) {
          window.location.href = "mailto:support@tectonic.com";
        }
        if (tab.id === 2) {
          window.location.href = "tel:9722333323";
        }
      },
      load: function(event, firstTab){
        $('#id-added-to-anchor').toggleClass('r-tabs-state-active');
        $('#id-added-to-anchor').toggleClass('r-tabs-state-default');
      },
    });
  }
});
jellekralt commented 7 years ago

The startCollapsed function expects a real boolean, you've set it as a string :)

MikeiLL commented 7 years ago

I knew it! Thank you very much.