I'm trying to create a twitter bootstrap dropdown that has somewhere between 7-36 menu items. Unfortunately with that many items, I can only see the first 15 or so. I'd like to be able to split the number of items so that there are no more than 10 per column, before a new column is created.
I'm not trying to do nested dropdowns, I'm just trying to change the presentation of the dropdown so that there are no more than 10 items per column, however all of the items should still be displayed. I tried putting every 10 li
s into their own div but that's not even HTML compliant I think. Is it possible to do this via TBS?
I adjusted the code to suit Bootstrap 3. For a 3-column dropdown:
I had to add the min-width, otherwise the 3rd column overflowed the right margin:
I have a recent post showing how to achieve this for 2 columns that should be easily modified to fit your needs by changing the width of the multi-column dropdown and changing the number of spans in your fluid row.
Check it out: http://www.devlifeline.com/2013/09/multi-column-bootstrap-dropdown.html
FYI - This keeps the styles consistent with other bootstrap dropdown menus
I've solved it by adding class "columns" where I've set columns count and drop down width. Of course you can set columns count and width depending on media queries.
https://jsfiddle.net/maciej_p/eatv1b4b/18/
HTML:
CSS:
Also have a look at the Mega Menu offerings out there.
(it helps if you say 'Mega Menu' in a silly voice)
Once decent offering is YAMM or YAMM3 (depending on which version of Bootstrap you are using).
You can use Bootstrap's
.row-fluid
to accomplish what you need.I've inlined the css for the width of the dropdown menu but you can specify a class/id and include that in your stylesheet.
Basically, what's going on here is:
li
tags are inheriting their style from the parent dropdownThe example below was only tested in Chrome v23
* Boostrap 2.x:
[EDIT]
* Boostrap 3.x:
Look over this plugin it will be useful for you.
http://alijafarian.com/bootstrap-multi-column-dropdown-menu/