diff --git a/administrator/templates/isis/js/template.js b/administrator/templates/isis/js/template.js index 38f5aed4dc67d..1cc34f8adebd6 100644 --- a/administrator/templates/isis/js/template.js +++ b/administrator/templates/isis/js/template.js @@ -69,108 +69,115 @@ /** * Append submenu items to empty UL on hover allowing a scrollable dropdown */ - var menuScroll = $('#menu > li > ul'), - emptyMenu = $('#nav-empty'); - - $('#menu > li').on('click mouseenter', function() { - - // Set max-height (and width if scroll) for dropdown menu, depending of window height - var $dropdownMenu = $(this).children('ul'), - windowHeight = $w.height(), - linkHeight = $(this).outerHeight(true), - statusHeight = $('#status').outerHeight(true), - menuHeight = $dropdownMenu.height(), - menuOuterHeight = $dropdownMenu.outerHeight(true), - scrollMenuWidth = $dropdownMenu.width() + 15, - maxHeight = windowHeight - (linkHeight + statusHeight + (menuOuterHeight - menuHeight) + 20); - - if (maxHeight < menuHeight) { - $dropdownMenu.css('width', scrollMenuWidth); - } else if (maxHeight > menuHeight) { - $dropdownMenu.css('width', 'auto'); - } + if ($w.width() > 767) { + + var menuScroll = $('#menu > li > ul'), + emptyMenu = $('#nav-empty'); + + $('#menu > li').on('click mouseenter', function() { + + // Set max-height (and width if scroll) for dropdown menu, depending of window height + var $dropdownMenu = $(this).children('ul'), + windowHeight = $w.height(), + linkHeight = $(this).outerHeight(true), + statusHeight = $('#status').outerHeight(true), + menuHeight = $dropdownMenu.height(), + menuOuterHeight = $dropdownMenu.outerHeight(true), + scrollMenuWidth = $dropdownMenu.width() + 15, + maxHeight = windowHeight - (linkHeight + statusHeight + (menuOuterHeight - menuHeight) + 20); + + if (maxHeight < menuHeight) { + $dropdownMenu.css('width', scrollMenuWidth); + } else if (maxHeight > menuHeight) { + $dropdownMenu.css('width', 'auto'); + } - $dropdownMenu.css('max-height', maxHeight); + $dropdownMenu.css('max-height', maxHeight); - // Get the submenu position - linkWidth = $(this).outerWidth(true); - menuWidth = $dropdownMenu.width(); - linkPaddingLeft = $(this).children('a').css('padding-left'); - offsetLeft = Math.round($(this).offset().left) - parseInt(linkPaddingLeft); + // Get the submenu position + linkWidth = $(this).outerWidth(true); + menuWidth = $dropdownMenu.width(); + linkPaddingLeft = $(this).children('a').css('padding-left'); + offsetLeft = Math.round($(this).offset().left) - parseInt(linkPaddingLeft); - emptyMenu.empty().hide(); + emptyMenu.empty().hide(); - }); + }); - menuScroll.find('.dropdown-submenu > a').on('mouseover', function() { + menuScroll.find('.dropdown-submenu > a').on('mouseover', function() { - var $self = $(this), - dropdown = $self.next('ul'), - submenuWidth = dropdown.outerWidth(), - offsetTop = $self.offset().top, - linkPaddingTop = parseInt(dropdown.css('padding-top')) + parseInt($(this).css('padding-top')), - scroll = $w.scrollTop() + linkPaddingTop; + var $self = $(this), + dropdown = $self.next('ul'), + submenuWidth = dropdown.outerWidth(), + offsetTop = $self.offset().top, + linkPaddingTop = parseInt(dropdown.css('padding-top')) + parseInt($(this).css('padding-top')), + scroll = $w.scrollTop() + linkPaddingTop; - // Set the submenu position - if ($('html').attr('dir') == 'rtl') - { - emptyMenu.css({ - top : offsetTop - scroll, - left: offsetLeft - (menuWidth - linkWidth) - submenuWidth - }); - } - else - { - emptyMenu.css({ - top : offsetTop - scroll, - left: offsetLeft + menuWidth - }); - } + // Set the submenu position + if ($('html').attr('dir') == 'rtl') + { + emptyMenu.css({ + top : offsetTop - scroll, + left: offsetLeft - (menuWidth - linkWidth) - submenuWidth + }); + } + else + { + emptyMenu.css({ + top : offsetTop - scroll, + left: offsetLeft + menuWidth + }); + } - // Append items to empty