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

Prevent other panels from collapsing #31

Closed hatcham closed 9 years ago

hatcham commented 9 years ago

How might one alter this (superb) plugin to have open panels left open when opening another panel?

Generally one would either remove the "data-parent" attribute, or add a "data-target" attribute. I have tried both, but with no success.

Thank you.

openam commented 9 years ago

Nothing like that is currently supported. It doesn't make sense when you translate it back to the tabs either. There is no way to have multiple tabs open at the same time. This ties the tab to a collapse, so that if you resize your window the proper tab/collapse is open.

What tab would be shown if you have 2+ collapse panels visible?

hatcham commented 9 years ago

Thank you for responding. You explanation makes complete sense, my requirement does not fit into a tabbed layout at all.

I am still left with the issue that when using accordions on a small screen, where each panel has more than a screen's height of content within, that opening and closing panels makes the content I want to read scroll out of view.

If I find a reasonable solution I will post it here.

hatcham commented 9 years ago

It's not a perfect solution, but it works. Some jQuery to scroll to the top of the open panel:

$('#accordion').on('shown.bs.collapse', function () {
    var panel = $(this).find('.in').parent();
    $('html, body').animate({
          scrollTop: panel.offset().top
    }, 500);
});