diff --git a/js/menu-resizer.js b/js/menu-resizer.js index 99293dd3e0c..d4913d9d530 100644 --- a/js/menu-resizer.js +++ b/js/menu-resizer.js @@ -24,59 +24,63 @@ var self = this; self.$container = $container; self.widthCalculator = widthCalculator; - // Sets the image for the left and right scroll indicator - $(PMA_getImage('b_right.png').toString()).prependTo($('.scrollindicator--right')); - $(PMA_getImage('b_left.png').toString()).prependTo($('.scrollindicator--left')); + var windowWidth = $(window).width(); - // Set the width of the navigation bar without scroll indicator - $('.navigationbar').css({'width': widthCalculator.call($container) - 58}); + if (windowWidth < 768) { + // Sets the image for the left and right scroll indicator + $(PMA_getImage('b_right.png').toString()).prependTo($('.scrollindicator--right')); + $(PMA_getImage('b_left.png').toString()).prependTo($('.scrollindicator--left')); - // Scroll the navigation bar on click - $('.scrollindicator--right') - .click(function () { - $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() + 10); - }); - $('.scrollindicator--left') - .click(function () { - $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() - 10); - }); - // create submenu container - var link = $('', {href: '#', 'class': 'tab nowrap'}) - .text(PMA_messages.strMore) - .on('click', false); // same as event.preventDefault() - var img = $container.find('li img'); - if (img.length) { - $(PMA_getImage('b_more.png').toString()).prependTo(link); + // Set the width of the navigation bar without scroll indicator + $('.navigationbar').css({'width': widthCalculator.call($container) - 58}); + + // Scroll the navigation bar on click + $('.scrollindicator--right') + .click(function () { + $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() + 70); + }); + $('.scrollindicator--left') + .click(function () { + $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() - 70); + }); + } else { + // create submenu container + var link = $('', {href: '#', 'class': 'tab nowrap'}) + .text(PMA_messages.strMore) + .on('click', false); // same as event.preventDefault() + var img = $container.find('li img'); + if (img.length) { + $(PMA_getImage('b_more.png').toString()).prependTo(link); + } + var $submenu = $('
  • ', {'class': 'submenu'}) + .append(link) + .append($('