Is there not yet support for dropdown menus in the main menu navbar?

It seems like the support for it is commented out in the twitter_bootstrap_menu_link hook, but this isn't used for the main nav? I just want to check that I'm not missing an easy fix before hacking away to get this working. Thanks.

Comments

Jack3rror’s picture

I think you must install jquery 1.7 instead of jquery 1.4 wich is the default version on drupal 7.

Melissamcewen’s picture

make sure you have clicked "show as expanded" in the menu item options. If that doesn't work you need jquery 1.7 and perhaps this readme file can help
http://drupal.org/node/1668794

tchopshop’s picture

I have not been able to get dropdowns working on any menu in a block. I've installed query 1.7, I've used "show as expanded". I've uncommented the lines in menu_link_hook.

The markup seems to be right (when you uncomment those lines), but the dropdown is still not working.

I'm pulling my hair out on this one!

Please help!

natted’s picture

Category: feature » support
Status: Active » Postponed (maintainer needs more info)

Hello,

Sorry but I am not able to reproduce.

Just as @Melissamcewen mentioned earlier, you need to click show as expanded and also have the parent menu item set.

If you can demonstrate the issue so that I can reproduce, then maybe I can assist.

tchopshop’s picture

StatusFileSize
new156.08 KB
new51 KB
new199.58 KB
new140.87 KB
new77.6 KB

Perhaps you are thinking only about the main menu in the Navigation bar with the twitter logo. This issue is not about that -- that works, but that menu is hard-coded.

I want to use the system menu block for the main menu. Or a menu-block for Main Menu. With that menu block the drop downs do NOT work.

I've tried it in many configurations and finally I have installed it on a pristine site, with only a few modules -- jquery update, libraries, twitter bootstrap ui.

  • I've update query to use 1.7.
  • I've created a fake main menu and created a parent item.
  • I've checked "show as expanded" on the parent and the subitem
  • I've placed the main menu block in the top bar region
  • I've uncommented the lines from the function twitter_bootstrap_menu_link

See attachments showing all this.

The drop down is not working and it's frustrating. Don't you want more flexibility with the menu system, to use all the menus that Drupal outputs, not just hard-coding it in the template.php?

natted’s picture

Hi @tchopshop,

Thanks for the extra detail - it helps me greatly. I will have a look and see what I can improve with a patch. The original poster only asked about the Navigation, which is why I asked.

I'd love to solve these issues permanently but I'm not a maintainer and can only post patches.

tchopshop’s picture

Thank you @natted. Tinkering with the preprocess functions a bit I have gotten the html to be what is needed for it to work -- identical in class and attributes to the navigation menu which *does* work -- but even so the javascript will not apply the class "open" to the element to make it trigger the drop down. I really don't understand why.

eg2234’s picture

Yes, thank you, @natted! @tchopshop is definitely not the only person having trouble with this.

wooody’s picture

Anyone fix the problem..
I think we need to make it like this
http://www.bootstrapmenumod.net/examples/navbar/navbar-with-dropdowns

wooody’s picture

I have idea to make it , If u use the Special menu items module
http://drupal.org/project/special_menu_items

and make the main item as and put the sub items it will work fine .

BR,

tchopshop’s picture

@wooody, can you explain further what you mean?

stevenx’s picture

Upgrading to jquery 1.7 with the module jquery_update worked for me
thanks to #1

wooody’s picture

@tchopshop If u want make item in menu and make Sub-menu ,,, Dropdown list , u can use the Special menu items module to make Main item in main menu and then make the sub-items.

natted’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.93 KB
new40.34 KB

Hi guys,

Please try this patch and let me know whether this solves the issue.

If you use the latest dev version with this patch, you should see dropdown menus when the menu item is set to "expanded".

It also allows you to nest expanded menus and they will appear as submenus.

Patch demo

Cheers.

natted’s picture

I can think of a couple of scenarios where this could be improved, it probably should be optional as well.... so I'll try work on it again later this week.

zmove’s picture

Hello,

It is possible to make the dropdown working for main menu block ? Actually the main menu is called with the $primary_nav variable, but you can add the main menu using drupal block system too (which is more flexible).

It is possible to make it compatible ? Actually its not.

Same for search

Regards

Alex

natted’s picture

Hi Alex,
Yes, it is possible. Give the patch a try and it should work.

natted’s picture

I need to reroll patch in #14 against latest dev.

andregriffin’s picture

Project: Twitter's Bootstrap » Bootstrap Framework
andregriffin’s picture

Project: Bootstrap Framework » Twitter's Bootstrap
natted’s picture

Project: Twitter's Bootstrap » Bootstrap

Status: Needs review » Needs work

The last submitted patch, twitter_bootstrap-menu-dropdown-1706180-14.patch, failed testing.

zmove’s picture

Status: Needs work » Reviewed & tested by the community

tested the patch and it works.

Just one thing:

Replace
$element['#href'] = "#";

By

$element['#localized_options']['attributes']['data-target'] = '#';

frankbaele’s picture

StatusFileSize
new4.53 KB

Well i have been snooping around the menus and cleaning up.

here is an other patch, but i think i went too far with it, i added your patch and also remove the main menus and replaced them with a navigation region.

any thoughts on that?

frankbaele’s picture

cleaned up the patch so that it only contains code related to this issue, my bad

frankbaele’s picture

StatusFileSize
new1.69 KB

patch itself

frankbaele’s picture

StatusFileSize
new1.83 KB

ok i narfed that patch up, here is new one

zmove’s picture

Seems perfect to me.

joshuautley’s picture

#27 worked for me.

Dropdown Sub-menus do not work though. Anyone else working on Sub-menus in the Main Menu?

frankbaele’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

fixed in this issue http://drupal.org/node/1850934

frankbaele’s picture

Status: Closed (duplicate) » Needs review

oops wrong issue sorry

frankbaele’s picture

Category: support » feature
natted’s picture

#27: dropdown_menu_v2.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, dropdown_menu_v2.patch, failed testing.

natted’s picture

My only problem with this patch are that it currently forces all menus to be dropdowns. My plan when submitting the original patch was to allow for it to be configurable but I didn't get to that...

I don't really think it works well if all menu's default to dropdowns.

natted’s picture

Perhaps it's just something with my sandbox, I will retest.

natted’s picture

StatusFileSize
new1.69 KB

Ok, issue was my sandbox.

I've re-rolled.

natted’s picture

Status: Needs work » Needs review
natted’s picture

Status: Needs review » Fixed

I've committed the patch. To make dropdown menu's, you can set the expanded option, same for nested menus.

cthiebault’s picture

I can't make sub menus work...

menu 1
  \  menu 1.1
    \  menu 1.1.1

It displays only a one level dropdown with menu 1.1. All my menus are shown as expanded.

I using latest commit #1a15c89.

Did I miss something?

frankbaele’s picture

this commit should be processed with http://drupal.org/node/1460508

natted’s picture

@cthiebault I've tested and it's definitely working for me.

I've just committed the patch to #1460508: Don't use menu_tree_page_data for $main_menu and $secondary_menu so, get the latest dev and try it out. Ensure that you have menu 1.1 set to expanded as well, not just the top menu.

If it's still not working, open a new issue with as much info as possible.

joshuautley’s picture

Works here. Thank you > natted!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

windmaomao’s picture

thanks #2 for "show as expanded" in the menu item options, very helpful