Dropdown menu with jQuery
HTML
<nav>
<a class="dropdown-toggle" href="#" title="Controls">⚙</a>
<ul class="dropdown" style="display:none">
<li>Renderer: <a href="#">SVG</a> | <a href="#">Canvas</a>
</li>
<li><a href="#">Download</a>
</li>
</ul>
</nav>
JavaScript
$(function () {
// Dropdown toggle
$('.dropdown-toggle').click(function() {
$(this).next('.dropdown').toggle();
});
$(document).click(function (e) {
var target = e.target;
if (!$(target).is('.dropdown-toggle') && !$(target).parents().is('.dropdown-toggle')) {
$('.dropdown').hide();
}
});
});