Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

menu toggle button - help needed

Home Forums Older releases 0.9.x menu toggle button - help needed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1376

    I am trying to add a menu toggle button so that the menu is collapsed when viewing on small screens, but after following the instructions here, my menu disappears completely when viewed on a small screen.

    And a second problem is my sub menus no longer appear on a full size screen.

    Everything was working perfectly before I added the additional code.

    Use this page as an example – (please view source to see how my UL element looks as I can’t seem to post it on here)

    I added this code to sm-blue.css:

    #menu-button {
      background: #3193c0;
      /* style it as you like... */
    #menu-button:before {
      content:'Menu -';
    #menu-button.collapsed:before {
      content:'Menu +';
    @media screen and (max-width: 640px) {
      /* show the button on small screens */
      #menu-button {
      /* hide the menu when it has the "collapsed" class set by the script */
      #main-menu.collapsed {

    I added this code to jquery.smartmenus.js:

    $(function() {
      $('#menu-button').click(function() {
        var $this = $(this),
            $menu = $('#main-menu');
        if (!$this.hasClass('collapsed')) {
        } else {
        return false;

    What have I done wrong?


    Hi, the problem is that you have added the menu button as part of your main menu (as the first item). Just move it out and add it, for example, right before the main menu – e.g.:

    <a id="menu-button"></a>
    <ul id="main-menu" class="sm collapsed sm-blue">

    and it should work.



    Great! Thank you

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.