Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: support collapsible vertical menu items in tabs plugin #14948

Closed
vkhoroz opened this issue Oct 30, 2014 · 8 comments
Closed

Comments

@vkhoroz
Copy link

vkhoroz commented Oct 30, 2014

Currently a tabs.js plugin supports a "dropdown" toggle class. This is suitable for horizontal tabs sub-menu, but for vertical tabs sub-menu a "collapse" toggle class is much more convenient.

This is an easy to introduce feature and I have a patch provided in a comment.
An example vertical menu where collapsible sub-menu is used to activate tabs is presented in an attachment.

@vkhoroz
Copy link
Author

vkhoroz commented Oct 30, 2014

collapsible-tabs-submenu

@vkhoroz
Copy link
Author

vkhoroz commented Oct 30, 2014

Patch file, so that you can play with it (please, let me know if I should make a pull request):

--- site/lib/bootstrap.3.2.0/js/bootstrap.js    2014-10-25 02:44:17.299181656 +0300
+++ site/lib/bootstrap.3.2.0/js/bootstrap.js.new        2014-10-25 02:44:02.459368217 +0300
@@ -1864,7 +1864,7 @@

   Tab.prototype.show = function () {
     var $this    = this.element
-    var $ul      = $this.closest('ul:not(.dropdown-menu)')
+    var $ul      = $this.closest('ul:not(.dropdown-menu):not(.collapse)')
     var selector = $this.data('target')

     if (!selector) {
@@ -1903,7 +1903,7 @@
     function next() {
       $active
         .removeClass('active')
-        .find('> .dropdown-menu > .active')
+        .find('> .dropdown-menu > .active, > .collapse > .active')
         .removeClass('active')

       element.addClass('active')
@@ -1915,7 +1915,7 @@
         element.removeClass('fade')
       }

-      if (element.parent('.dropdown-menu')) {
+      if (element.parent('.dropdown-menu') || element.parent('.collapse')) {
         element.closest('li.dropdown').addClass('active')
       }

@ghost
Copy link

ghost commented Oct 30, 2014

+1

@hnrch02
Copy link
Collaborator

hnrch02 commented Oct 31, 2014

Why not just restyle the dropdown menu to look like you want it to? That's what the responsive navbar does for small viewports.

@vkhoroz
Copy link
Author

vkhoroz commented Oct 31, 2014

@hnrch02, because restyling means a lot of custom CSS to make "dropdown" look like "collapse", moreover, this will be not less than 90% CSS copied from Bootstrap.

I don't think this is a good practice and is hard to maintain as this CSS will have to be updated with every new version of Bootstrap.

@hnrch02
Copy link
Collaborator

hnrch02 commented Oct 31, 2014

Yeah, but that's the drawback of working with stuff the framework doesn't support. We don't have any horizontal tab menus in v3 and therefore adding this doesn't make much sense other than to support your specific use case.

Edit: I forgot about stackable pills. Still my point about restyling dropdowns stands. I got an acceptable style with less than 10 lines of code.

@cvrebert
Copy link
Collaborator

cvrebert commented Nov 2, 2014

Somewhat relevant: https://github.com/dbtek/bootstrap-vertical-tabs
But yeah, @mdo specifically removed Bootstrap v2's vertical tab variations in v3.

@mdo
Copy link
Member

mdo commented Nov 9, 2014

Punting for now, but i could see making some changes to either tabs or collapse in v4 to account for something like this.

@mdo mdo closed this as completed Nov 9, 2014
@mdo mdo mentioned this issue Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants