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 260 forks source link

Active accordion bug on window resize #99

Open maximQa-kgd opened 4 years ago

maximQa-kgd commented 4 years ago

If you close opened accordion and then resize window, the last active accordion will be opened again and if you try to close it, it will close and then opens. This happens becouse the author remove attribute from tabs on line 217 $respTabs.find('.resp-accordion-closed').removeAttr('style');

To fix this all you have to do is to check window width, if it's more than the brakpoint when tabs becomes accrodion. in my case this breakpoint eqauls to 767px, so i check it like this $(window).on('resize', function () { if ( $(window).width() > 767 ) { $respTabs.find('.resp-accordion-closed').removeAttr('style'); } });