causeway-standard-theme
Version:
299 lines (286 loc) • 8.43 kB
HTML
<section>
<a id="menus-dropdown"></a>
<header class="content-header">
<h1 class="title">
Dropdown Menu
</h1>
</header>
<p>
Dropdowns form the basis for all of the menu types available in this theme.
</p>
<p>
They comprise of a surround with a class of <code>"dropdown"</code>, a trigger element (preferably containing a caret) and a list (unordered <code><ul></code> or ordered <code><ol></code>).
</p>
<p>
The trigger element must have a class of <code>"dropdown-toggle"</code> and an attribute of either <code>"data-toggle"</code> or <code>"data-hover"</code> set to <code>"dropdown"</code>. The list must have a class of <code>"dropdown-menu"</code>.
</p>
<br/>
<br/>
<p>
The attributes on the trigger element cause differing behaviour:
</p>
<table class="table table-striped example-dropdowns">
<thead>
<tr>
<th>
Attribute
</th>
<th>
Effect
</th>
<th>
Caveats
</th>
<th class="last-column">
Examples
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4"></td>
</tr>
</tfoot>
<tbody>
<tr>
<td>
<code>data-toggle</code>
</td>
<td>
The dropdown appears when the trigger element is clicked and disappears when the trigger element is clicked for a second time.
</td>
<td>
The trigger element cannot be used as a link when used in this manner.
</td>
<td>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Toggle Example
<span class="fa fa-chevron-down"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
<code>data-hover</code>
</td>
<td>
The dropdown appears when the cursor hovers over the trigger element and disappears a few seconds after the cursor leaves the element.
</td>
<td>
</td>
<td>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Hover Example
<span class="fa fa-chevron-down"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
<pre>
<code>
<span class="title">
Toggle Example
</span>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Toggle Example
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</div>
<br/>
<span class="title">
Hover Example
</span>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Hover Example
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</div>
</code>
</pre>
<br/>
<p>
Menu items can also be given a class to bring in some default stylings (<code>"dropdown-header"</code>, <code>"active"</code> or <code>"disabled"</code>). A separator item (an <code><li></code> tag with a class of <code>"divider"</code>) can be used to help differentiate between sub sections:
</p>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Item Styles
<span class="fa fa-chevron-down"></span>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header">
Header Item
</li>
<li class="divider"></li>
<li class="active">
<a href="#">
Active Item
</a>
</li>
<li class="disabled">
<a href="#">
Disabled Item
</a>
</li>
<li>
<a href="#">
Default Item
</a>
</li>
</ul>
</div>
<br/>
<pre>
<code>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Item Styles
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header">
Header Item
</li>
<li class="divider"></li>
<li class="active">
<a href="#">
Active Item
</a>
</li>
<li class="disabled">
<a href="#">
Disabled Item
</a>
</li>
<li>
<a href="#">
Default Item
</a>
</li>
</ul>
</div>
</code>
</pre>
</section>
<section>
<a id="menus-dropdown-submenus"></a>
<header class="content-header">
<h3 class="title">
Submenus
</h3>
</header>
<p>
For menus with large sub sections it is desirable to split these out into specific submenus. This can be accomplished by treating a menu item as a trigger element and adding a new dropdown menu alongside it.
</p>
<p>
The surround for the submenu trigger element should replace the <code>"dropdown"</code> class with <code>"dropdown-submenu"</code> and the trigger element itself should omit any <code>"dropdown-toggle"</code> class or <code>"dropdown-hover"</code> or <code>"dropdown-toggle"</code> attributes.
</p>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Submenu Example
<span class="fa fa-chevron-down"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li class="dropdown-submenu">
<a href="#">
Open Submenu
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</li>
</ul>
</div>
<pre>
<code>
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown">
Submenu Example
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action
</a>
</li>
<li class="dropdown-submenu">
<a href="#">
Open Submenu
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Another action
</a>
</li>
</ul>
</div>
</ul>
</div>
</code>
</pre>
</section>