Toggles: HTML

Knowledgebase Docs » ShiftNav » Toggles
USEFUL? 9

Creating a toggle in HTML has two basic requirements:

1. It must have the class shiftnav-toggle

2. It must have a data-shiftnav-target attribute set to the ID of the menu that should be toggled upon activation

Here’s an example of a toggle for the main ShiftNav

<a class="shiftnav-toggle" data-shiftnav-target="shiftnav-main"> Toggle Content </a>

This will create a link with the text “Toggle Content” that, when clicked, will toggle the Main ShiftNav open and closed.

By default, ShiftNav won’t add any styling to this link, but you can use classes from your theme (button or btn are common) to style the toggle as a button or however you like.