openam / bootstrap-responsive-tabs

Bootstrap responsive tabs are tabs that switch to collapsible components (accordions) when resized.
openam.github.io/bootstrap-responsive-tabs
MIT License
132 stars 60 forks source link

Re-initialize responsive tabs #47

Closed savyk closed 8 years ago

savyk commented 9 years ago

I'm trying to use responsive tabs in conjunction with JQuery UI Sortable to rearrange the tabs. I run into a problem with being unable to reinitialize the responsive tabs after a tab has been moved. Testing I have run into 2 scenarios. First, I only do the initial responsive tabs call and sorting works in a full desktop view but when moving to sm, xs the order reverts to the original order until brought back to full view. Second, if I try to initialize responsive tabs again after the sort, two sets of accordions display - one with the correct order and one with the original (because it creates a second instead of re-initializing the first).

Is there a way to refresh or re-initialize so it can pick up the new tab order? Here is a fiddle with my test case. Comments (lines 230, 237) towards the end of the js show where to change to get both of my test cases. http://jsfiddle.net/dcgj8att/

savyk commented 8 years ago

Looks like if I use the following code I can remove the old accordion and then call responsive-tabs again letting me reset the order:

        $("[id^='collapse-']").remove();
        fakewaffle.responsiveTabs(['xs']);