• Resolved Funkan

    (@funkan)


    Is it possible to add a secondary, horizontal menu under the original one, that is always visible? Not at dropdown or on hover?

    I would like to always show the top level menu, and then the first sublevel underneath it, as they do on this page: http://danskebank.se

Viewing 15 replies - 16 through 30 (of 30 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You may need to create a new thread for this.

    Thanks, Andrew. I will

    @borismod: You don’t need a new thread for this, as it’s exactly what Funkan asked for and exactly what the solution provided above does. You may see the code above in action here (both php and css). If you need a more complex menu, you’ll need to extend the CSS.

    If you want your menu to be displayed horizontally just make sure all your menu elements from secondary menu are top level (no children). The CSS provided above is basic and is only intended to make a single level menu show up ok. If you want a multi-level menu you need to style it further (hide 2nd level items and above, only display them on parent:hover, position them absolute, provide proper padding and dimensions, etc…).

    That’s a clever solution – just adding a second main menu below the first main menu. But it’s not actually what Funkan and I are trying to achieve – we’re trying to make our submenus behave like the main menu items: always visible and highlighted on the current page.

    It’s a shockingly difficult thing to do, apparently. It’s taken me two weeks to learn enough css coding to get my horizontal main menu and submenus; to align properly (with submenus lining up with the main menu parent selection instead of aligning left, right, or center), to look right (with custom hover and selection colors), and to function smoothly (sizing their containers without overlap).

    But keeping those submenus from disappearing when a page is selected remains elusive. It works perfectly on the link Funkan provided: http://danskebank.se

    I had to disable my NoScript add-on to see it in action, but when you click on a main menu item, the corresponding submenu shows up, and the selected submenu item remains highlighted while you’re on the page.

    Which is, I feel, the most intuitive, obvious, and spatially-economic navigation structure. I couldn’t get there with my enfold theme, so I bought UberMenu, thinking it would offer this functionality. And I’ve spent days groping in the dark adding new css to get the job done, but still: donuts.

    If anyone knows how to keep the submenu visible, I can probably figure out the rest. I can’t believe it’s so difficult. And I’m sure that many users are wasting days of time searching for the answer, as I have.

    Thank you ;

    Scourge666: if you’re having such difficulty with the CSS, perhaps it would be better to choose a theme that has these sorts of menus built in? Or hire someone to help you?

    If you want to take the harder route, then I suggest you learn Firebug and use it to work out how other sites do what they do that you like.

    ElectricFeet: I started using Firebug yesterday actually, and it is quite helpful on many issues, especially aesthetic ones, where it’s simply a matter of isolating a line of code and editing it to suit your desires.

    Functionality is a different matter though, because every website seems to implement a different set of php css and js files that work in tandem apparently, employing different classes and hierarchy nomenclature that look and work nothing like my mega menu code and wordpress files, so I can’t just steal code and drop it into my files. Whenever I try, it either doesn’t do anything, or breaks my entire site (especially when I try to add code to my functions.php child theme file).

    And kissing goodbye to the $80 I’ve spend on my theme and plugins so far, and hiring a programmer, well, those options simply reek of defeat. Besides, my nav bar finally looks *sweet* and this is the last obstacle to unmitigated triumph. So it’s no sleep til Brooklyn…

    Here’s what I’ve got so far if anyone cares to see:
    http://morrisonsculpture.com/blog/bronze-sculpture

    I haven’t taken the time to clean up all of the inactive code yet (carcasses of the learning process), but there’s a time to work, and a time to clean…

    do you mean like http://www.survivor-magazine.com

    I coded that back in the days of WP2 which had no custom menu support.

    Here is a great tutorial that i found today: http://www.designchemical.com/blog/index.php/wordpress-tips/wordpress-tutorial-current-parent-menu-items-in-custom-menus/

    Hope that helps.

    @scourge666 – congratulations! That’s an astonishing job from a newbie. Shows what’s possible with Customizr when a thrusting young structural engineer inhabits the same skin as a seasoned aesthete/minimalist.

    I’m wondering whether your menu-to-die-for is reproducible without the help of UberMenu… And I’m wondering where that amazing Search tool came from…

    (Also wondering what you have done to your slider but that’s obviously not for this thread).

    You still need to sort out your 3-bar menu – and change some of the @media rules to prevent your menu running into your logo between 990px and 767px; and the colours in your Search field need to change for legibility. But wow!

    gregsaxton: yep, you know exactly what I want I’m trying to do – and that Survivor Magazine website + navigation menu is trés elegant ;

    And I’ve been going back to that designchemical.com code all day actually, trying to figure out how to substitute the mega menu classes in there to make it work. But trying to make sense of -this stuff- is horrifying:

    #megaMenu,
    #megaMenu ul.megaMenu,
    #megaMenu ul.megaMenu > li.menu-item,
    #megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li > a,
    #megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li:hover > a,
    #megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu .ss-nav-menu-header > a,
    #megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li > span.um-anchoremulator,
    #megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu .ss-nav-menu-header > span.um-anchoremulator
    #megaMenu ul.megaMenu li.menu-item.ss-nav-menu-mega ul.sub-menu-1 > li.menu-item
    #megaMenu ul.megaMenu li.menu-item.ss-nav-menu-mega ul ul.sub-menu .ss-nav-menu-header
    #megaMenu ul.megaMenu > li.menu-item.ss-nav-menu-item-depth-0 > a,
    #megaMenu ul.megaMenu > li.menu-item.ss-nav-menu-item-depth-0 > span.um-anchoremulator
    #megaMenu ul.megaMenu > li.menu-item > span.um-anchoremulator
    #megaMenu ul.megaMenu > li.current-menu-item > a, #megaMenu ul.megaMenu > li.current-menu-parent > a, #megaMenu ul.megaMenu > li.current-menu-ancestor
    #megaMenu ul.megaMenu > li:hover > a span.wpmega-link-title,
    #megaMenu ul.megaMenu > li:hover > span.um-anchoremulator span.wpmega-link-title,
    #megaMenu ul.megaMenu > li > a:hover span.wpmega-link-title,
    #megaMenu ul.megaMenu > li > span.um-anchoremulator:hover span.wpmega-link-title,
    #megaMenu ul.megaMenu > li.megaHover > a span.wpmega-link-title,
    #megaMenu ul.megaMenu > li.megaHover > span.um-anchoremulator span.wpmega-link-title

    …apparently I need to substitute the correct terms above, in the right places for these:

    .menu
    .menu li
    .menu li a
    .menu li ul
    .menu li ul li
    .menu li ul li a

    …but that’s proving to be Very difficult to do without a Rosetta stone…and my usual strategy of “try all permutations until something happens” has been going n0where…

    Also, I keep getting distracted by tantalizing prospective solutions involving some kind of jQuery and/or php code, like this: http://stackoverflow.com/questions/20998261/dont-toggleslide-div-if-other-div-is-expanded-slid-open

    But unfortunately, nobody ever seems to mention where and how to implement these kinds of solutions :/

    chappie: thank you for the inspiring response =P I feel like I was just getting warmed up, then I got derailed by the beguiling intricacies of of navigation system (which I feel is the vital key to framing all of the content to follow).

    I actually tried to scrap the whole Ubermenu schtick earlier today, but a perverse iteration of my menu remained in the header even when I deleted all of my menus(!). Everything went back to normal after I re-created the existing Ubermenu navigation up now. Weird. Frustrating, also. Apparently I’m stuck with the horrors of Ubermenu’s convoluted class codes…brrr!

    The Enfold theme came with that nice Layerslider plugin…I played with it for a few days and scrapped some early efforts to get a feel for it. It’s pretty flexible – in fact if it had a hover-active function for layers, I could’ve made a tight menu with it.

    Thanks for pointing out that @media issue – I hadn’t noticed that. I think the Search box color problem is in the theme styling, but I reckon I’d best see if I can make the menu function before I look into it – I’m *very* concerned about throwing out the whole menu over this rotten submenu current-menu-item-parent-thingy issue 0.o

    gregsaxton: lol – get this…I took your advice and abandoned my futile efforts to mess with jQuery and/or php, and copied that code from the designchemical.com site:
    http://www.designchemical.com/blog/index.php/wordpress-tips/wordpress-tutorial-current-parent-menu-items-in-custom-menus/

    And then took a wild stab at making a Rosetta stone, to make that code work with my insane Ubermenu class structure, roughly as follows:

    .menu = #megaMenu ul.megaMenu
    .menu li = #megaMenu ul.megaMenu > li.menu-item
    .menu li a = #megaMenu ul.megaMenu > li.menu-item > a
    .menu li ul = #megaMenu ul.megaMenu > li.menu-item > ul.sub-menu
    .menu li ul li = #megaMenu ul.megaMenu > li.menu-item > ul.sub-menu > li.menu-item
    .menu li ul li a = #megaMenu ul.megaMenu > li.menu-item > ul.sub-menu > li.menu-item > a

    And after stripping out all of the styling I didn’t need, it kinda works ;P Thanks for steering me in the right direction! Man, I’m kinda shocked that the “blind man in a dark room looking for a black cat which is not there” uhm, strategy(?) sorta paid off.

    I’ll try to flesh out the kinks after some sleep and post the patch I stumbled upon, for the next feckless blighter who gets cornered by this maze of code madness…

    @scourge666 – since you now have a lot of time on your hands, I’d be grateful if you could make menu2 mouseover-contextual…ie it changes as you mouseover menu1.

    It would then be perfect, imho.

    chappie: do you have a link to an example? I don’t think I’ve ever seen a menu do that.

    And I’m not sure if I’d want it to…because you can either: A.) keep the submenu page item highlighted in the submenu to show the viewer where they are, or B.) make the submenu disappear when triggering another submenu on mouseover.

    With this structure you can’t have both, or the submenus will overlap each other.

    Also, I have no idea what I’m doing. I can steal a line of code here or there and get lucky sometimes, but how it works and what it means is totally beyond me. Perhaps a jQuery programmer could help you get where you want to go.

    So here’s the code you need if you want to make your mega menu submenus persistent – i.e., until a new main menu item is clicked. You can drop this into your custom.css stylesheet and it won’t mess up your formatting:

    /* Required to hide submenu when inactive */
    #megaMenu ul.megaMenu > li.menu-item > ul.sub-menu {
    display: none !important;
    }
    
    /* This is the rule that displays sub-menus when a parent link is clicked */
    #megaMenu ul.megaMenu > li.menu-item.current-menu-parent ul, #megaMenu ul.megaMenu > li.menu-item.current-menu-item ul {
    display: block !important;
    }

    @scourge666 – no example (or I would be there stealing it).

    Of course, this might be telling me that it’s A Bad Idea™.

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Adding a horizontal submenu/secondary menu?’ is closed to new replies.