Dropdown Menus

In ManaKeep, the main menu of your game site is just one level.  But if you want a dropdown menu item, you can create one on your site using a mix of javascript and css =)

To make this work, first make a new menu item called Games, which you can do in the Editor by clicking on the Pages tab and then the + icon.  And for this example, we'll assume you put it in the second position in the menu (with Home first). 

Now go to your Admin Panel -> Settings, and in the custom javascript field paste the following:

<script type="text/javascript">
  $(document).on('turbolinks:load', function() {
    $('#main-menu a:nth-child(3)').html('<div>Games ▾</div><ul><li><a href="/game1">Game 1</a></li><li><a href="/game2">Game 2</a></li></ul>');
  });  
</script>

What this does, is replace your Games menu item with a new one that has the text Games ▾ and two nested menu items for Game 1 and Game 2, that point to /game1 and /game2.   note that the selector for this needs to be the position of the item you want to replace +1, so our menu item is in the second position, so the selector is nth-child(3).

Then, you just need to add some css to make this work:

/* make dropdown menu open/close on mouseover */
#main-menu .menu-item:nth-child(3) ul { display: none; }
#main-menu .menu-item:nth-child(3):hover ul { display: block; }

/* make dropdown menu float over page */
#main-menu .menu-item:nth-child(3) { position: relative; }
#main-menu .menu-item:nth-child(3) ul { position: absolute; }

/* make dropdown have some style */
#main-menu .menu-item:nth-child(3) ul { background: #222; padding: 0; margin: 0; border-radius: 6px; }
#main-menu .menu-item:nth-child(3) li { list-style: none; line-height: 1; padding: 1em; }
#main-menu .menu-item:nth-child(3) li:hover { background-color: #111; }

And with that, you should now have a working dropdown menu!

One last thing to consider, on mobile this dropdown won't be there, as the mobile menu is a separate thing.  So I would recommend you make the Games link be a page with several blocks that show/link to your games.  This way on mobile, Games can go to your /games page, and on desktop it gets replaced to be a dropdown with the direct links to your games.

And you're done!  If you have any trouble adding this feel free to email us at support@manakeep.com =)