How to get a Simple jQuery Toggle panel on your website

Using WordPress Menus, This markup will give you a fixed height navigation panel that sticks out for the viewer until they want to hide it away. You start by creating the html markup.

Screen Shot 2013-08-13 at 12.04.54 PM

Note: You’ll need to set up your WordPress Menu called, “Main Nav” and select it to the “primary menu” under the WordPress admin section, “Apperance > Menus”.
Screen Shot 2013-08-13 at 12.03.45 PM
Then you might have to choose the screen options at the top of your screen to show “css classes”. Once you’ve done that you can specify the classes to each menu item from the css listed at the end of this page so that they correspond. That will tell the menu where in your image sprite it needs to show.
Screen Shot 2013-08-13 at 12.03.15 PM

We target the Close button that is absolutely positioned to toggle the panel in or out. Below is the jQuery that makes the panel work. It can go in it’s own script file in your template, or it’s pretty short so we can stick it in the header of our template.

And finally we need some css to control the look and position.

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − = 3