Code, Themes

Pure javascript multi-level navigation in WordPress

For some time now I have been using a pure¬†javascript drop down menu script called Drop in my WordPress themes for simple mobile friendly¬†multi-level navigation. I really like it because it doesn’t rely on any external libraries like jQuery. The library was created and is maintained by Chris Ferdindandi.

For the latest versions of Drop (version 6.1.1 at the time of this writing) I have needed to create a custom Walker Nav to add data attributes to list items which have sub-menus, initialize drop with some custom options, and use another small library called Astro (also maintained by Chris, and also written in pure javascript) to expand and collapse the menu on small screens.

Continue Reading …