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

question regarding active index: #20

Closed laki10 closed 10 years ago

laki10 commented 10 years ago

first of, great work with the responsive tabs.

quick question. I'm adding a function call to the activate event, but can't seem to figure out how to get the index of the selected tab in this call?

i.e. activate: function() { console.log(new active tab index?); }

I have some ajax loads that I need to do only on certain tabs to make the site faster.

thanks!

laki10 commented 10 years ago

managed to get it using var selectedTab = location.hash.replace("#", "");
not sure if there is a better way.

jellekralt commented 10 years ago

Hi there,

Thanks! Good point about the active tab index. I actually thought that I provided some kind of argument to the activate callback. Turns out, I didn't :). As this was a simple change i've immediately added a solution. If you update to the latest versions of the plugin, you now should have the arguments 'event' and 'tab' in the activate and deactivate functions. the tab object contains the id (and some more info). Hope this helps :)

laki10 commented 10 years ago

Very nice. works like a charm. and seems safer than the workaround.

Thank you for the quick turnaround! :)