jQuery click to open menus

<script type="text/javascript">
jQuery(document).ready(function(){
frCurrentOpenMenuId = false;
jQuery('#mobile-nav a[href="#"]').click(function(event){
var parent = jQuery(this).parent().attr('id');
if(frCurrentOpenMenuId == parent){
jQuery('#' + parent).removeClass('submenu-open');
frCurrentOpenMenuId = false;
}
else{
jQuery('.menu-item-has-children').removeClass('submenu-open');
jQuery('#' + parent).addClass('submenu-open');
frCurrentOpenMenuId = parent;
event.preventDefault();
event.stopPropagation();
}
});
jQuery(document).click(function(){ jQuery('.menu-item-has-children').removeClass('submenu-open'); frCurrentOpenMenuId = false; });
});
</script>

0 Comments

You must be logged in to post a comment.