in js/custom.js [776:875]
(function() {
var $mainMenu = $('#mainMenu').children('ul');
$mainMenu.on('mouseenter', 'li', function() {
var $this = $(this),
$subMenu = $this.children('ul');
if( $subMenu.length ) $this.addClass('hover').stop();
else {
if($this.parent().is($(':gt(1)', $mainMenu))){
$this.addClass('Shover').stop(false, true).hide().fadeIn('slow');
}else{
$this.addClass('Shover').stop(false, true);
}
}
if($this.parent().is($(':gt(1)', $mainMenu))){
$subMenu.css('display', 'block');
$subMenu.stop(false, true).animate({
left:144,
opacity:1
}, 300,'easeOutQuad');
}else{
$subMenu.stop(false, true).slideDown('fast','easeInQuad');
}
}).on('mouseleave', 'li', function() {
var $nthis = $(this);
if($nthis.parent().is($(':gt(1)', $mainMenu))){
$nthis.children('ul').stop(false, true).css('left', 130).css('opacity', 0).css('display', 'none');
}else{
$nthis.removeClass('hover').removeClass('Shover').children('ul').stop(false, true).hide();
}
$subMenu = $nthis.children('ul');
if( $subMenu.length ) $nthis.removeClass('hover');
else $nthis.removeClass('Shover');
}).on('touchend', 'li ul li a', function(e) {
var el = $(this);
var link = el.attr('href');
window.location = link;
});
// ul to select
var optionsList = '<option value="" selected>Navigate...</option>';
$mainMenu.find('li').each(function() {
var $this = $(this),
$anchor = $this.children('a'),
depth = $this.parents('ul').length - 1,
indent = '';
if( depth ) {
while( depth > 0 ) {
indent += ' - ';
depth--;
if($this.has('ul').length){
$anchor.addClass('hasSubMenu');
}
}
}
optionsList += '<option value="' + $anchor.attr('href') + '">' + indent + ' ' + $anchor.text() + '</option>';
}).end().after('<select class="responsive-nav">' + optionsList + '</select>');
$('.responsive-nav').on('change', function() {
window.location = $(this).val();
});
})();