SlickNav icon indicating copy to clipboard operation
SlickNav copied to clipboard

Show submenu without hover

Open stevelolz opened this issue 11 years ago • 8 comments

Is there a way for the submenu items to be visible without clicking the parent item when you open the menu?

stevelolz avatar Oct 06 '14 21:10 stevelolz

Steve - I'm wondering the same thing. Did you figure out a solution?

johnflufin avatar Nov 04 '14 05:11 johnflufin

<ul role="menu" class="dropdown-lysobact slicknav_hidden" aria-hidden="true" style="/* display: none; */"> 
  • but to be honest dont know why then you need this menu, if you need it visible - just use css.. - or edit aria-hidden,slicknav_hidden part in js file.

apsolut avatar Nov 13 '14 02:11 apsolut

apsolut - Unless I misunderstood stevelolz, we're wanting all menu items (parents & children) to display when the menu is opened rather than hiding the children and requiring a click to view them.

Thanks for your suggestion. I think I figured out a possible css only solution:

.slicknav_nav ul { display: block !important; }
.slicknav_nav .slicknav_arrow { display: none; } /* hide arrows */

Downside is the menu still animates when you click a parent. Not ideal but at least it springs back open when it ends.

johnflufin avatar Nov 13 '14 03:11 johnflufin

You can remove in .js - el.addClass(prefix+'_hidden');, rename all to false el.attr('aria-hidden','true'); , and change _animating ... this should unhide them all and stop animation...

apsolut avatar Nov 13 '14 03:11 apsolut

Nice but, personally, I don't like to tinker with code that future updates could break or requires repatching. I wish there was a native solution. For instance

$('#menu').slicknav({
    hideChildren: false
});

johnflufin avatar Nov 13 '14 03:11 johnflufin

this is inside code: 'showChildren': false // Show children of parent links by default.

apsolut avatar Nov 13 '14 03:11 apsolut

Great. I wonder why this isn't documented at http://slicknav.com/.

johnflufin avatar Nov 13 '14 06:11 johnflufin

Thanks apsolut and johnflufin!

stevelolz avatar Nov 13 '14 16:11 stevelolz