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

Setting opts.active does not open accordion #90

Closed timkelty closed 8 years ago

timkelty commented 8 years ago

If opts.active is set and the initial state is accordion, no accordion is opened.

Seems to work when loading in a tabs state.

timkelty commented 8 years ago

I achieved what I was looking for by calling .active on the instance instead of using opts.active:

$tabGroup.data('responsivetabs').activate(activeTabIndex);
jellekralt commented 8 years ago

Are you sure you haven't also set startCollapsed: 'accordion',? I've tested it (without that option) and it seems to work fine

timkelty commented 8 years ago

Right you are!

Since i was conditionally setting the active, I guess I was expecting this setting this to override the startCollapsed setting.

In my conditional I am now setting active as well as startCollapsed and it works as I was expecting. Thanks!

jellekralt commented 8 years ago

The options seem to be a bit conflicting indeed, I might look into clarifying this more in the future. Glad that its working for you though!