Skip to main content Skip to main navigation

Dropdowns

Dropdowns require jQuery and the Mercury UI Framework dropdown plugin to work. Note: You will need to initialize them by calling $().mercuryuiDropdown();.

You can also open and close dropdowns individually via the plugin through actions by targeting the id of the dropdown: $('#dropdown-base').mercuryuiDropdown('open'); and $('#dropdown-base').mercuryuiDropdown('close');.

Callbacks are provided for beforeOpen, afterOpen, beforeClose, and afterClose. An example for afterOpen would be: $('#dropdown-base').mercuryuiDropdown('open', { afterOpen: function(){ alert('Dropdown opened!'); } });

Base

<div class="dropdown margin--off">
    <button type="button" class="button button--white dropdown--button" id="dropdown-base-button" aria-controls="dropdown-base" aria-haspopup="true" aria-expanded="false">
        Dropdown <span class="arrow"></span>
    </button>
    <div class="dropdown--list" id="dropdown-base" aria-labelledby="dropdown-base-button" aria-expanded="false" aria-hidden="true">
        <a href="#" class="dropdown--link">Dropdown Link</a>
        <div class="dropdown--divider"></div>
        <a href="#" class="dropdown--link">Dropdown Link</a>
    </div>
</div>

Right Aligned

Note: Right aligned dropdowns may extend off of the screen if you're not careful, like the example below. Use the breakpoint classes below for the best results.

<div class="dropdown dropdown--right margin--off">
    <button type="button" class="button button--white dropdown--button" id="dropdown-right-button" aria-controls="dropdown-right" aria-haspopup="true" aria-expanded="false">
        Dropdown <span class="arrow"></span>
    </button>
    <div class="dropdown--list" id="dropdown-right" aria-labelledby="dropdown-right-button" aria-expanded="false" aria-hidden="true">
        <a href="#" class="dropdown--link">Dropdown Link</a>
        <div class="dropdown--divider"></div>
        <a href="#" class="dropdown--link">Dropdown Link</a>
    </div>
</div>