Add js for mako based masthead

This commit is contained in:
guerler
2016-02-29 15:08:00 -05:00
committed by Martin Cech
parent 65d9ec9cab
commit 5bc55f9fa2
@@ -5,6 +5,28 @@
<%def name="javascripts()">
${parent.javascripts()}
<script type="text/javascript">
$(document).ready( function() {
// Masthead dropdown menus
var $dropdowns = $("#masthead ul.nav > li.dropdown > .dropdown-menu");
$("body").on( "click.nav_popups", function( e ) {
$dropdowns.hide();
$("#dd-helper").hide();
// If the target is in the menu, treat normally
if ( $(e.target).closest( "#masthead ul.nav > li.dropdown > .dropdown-menu" ).length ) {
return;
}
// Otherwise, was the click in a tab
var $clicked = $(e.target).closest( "#masthead ul.nav > li.dropdown" );
if ( $clicked.length ) {
$("#dd-helper").show();
$clicked.children( ".dropdown-menu" ).show();
e.preventDefault();
}
});
});
</script>
</%def>
## Masthead