Toggling sub-menu items in slimMenu with links, not just buttons
- Jamie Johnson
Author of Velocity: The Basics: Scripting with a $ here and a # to do, Web Developer and former Computing Support Analyst and Licensed Professional Counselor
April 24, 2015
jQuery slimMenu, by Adnan Topal, is a useful responsive collapsing multi-level menu. jQuery slimMenu users, do you want to toggle multi-level sub-menu items at lower resolution with links as well as buttons? Check out my code needed in the bottom of the HTML page using slimMenu:
<script> /* start enable link toggle by jamesarthurjohn This allows the links in the lower resolution instance of Slimmenu to toggle multi-level sub-menus when clicking the link as well as the button. */ $(".slimmenu > li > a").each(function(){ $(this).click(function(){ $(this).siblings('.sub-collapser').click(); }); }); /* end enable link toggle by jamesarthurjohn */ </script>
That's it!
You can also check out my proposed update to slimMenu on Github.