samsono / Easy-Responsive-Tabs-to-Accordion

Easy responsive tabs - is a lightweight jQuery plugin which optimizes normal horizontal or vertical tabs to accordion on multi devices like: web, tablets, Mobile (IPad & IPhone). This plugin adapts the screen size and changes its action accordingly.
Other
603 stars 259 forks source link

Added any Data attributes from tab to Accordion #15

Closed digiguru closed 10 years ago

digiguru commented 10 years ago

So if you have the following code:

    <div id="demoTab">          
        <ul class="resp-tabs-list">
            <li data-type="fish">Shark</li>
            <li data-type="fish">Tuna</li>
            <li data-type="mammal">Whale</li>
        </ul> 

        <div class="resp-tabs-container">                                                        
            <div>Shark facts</div>
            <div>Tuna Facts</div>
            <div>Whale Facts</div>
        </div>
    </div>    

Then the data("type") attribute is now honored on both the accordion and the tab

$('#demoTab').easyResponsiveTabs({
   activate: function (e) {
       console.log($(e.target).data("type"));
   }
});

Before the above would output undefined when running in accordion mode. Now it outputs the data type assigned to that tab.