From cec2893d3bd35ef0a99ec832c241e7a516f5da14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 14 Jun 2017 11:08:45 +0200 Subject: [PATCH] Show at least 8 icons, don't use percentage on mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/js/js.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/js/js.js b/core/js/js.js index 7264198dc8..8f16d02f96 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1512,9 +1512,22 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); + var headerWidth = $('#header-left').width() - $('#nextcloud').width() var usePercentualAppMenuLimit = 0.33; - var availableWidth = (($('#header-left').width() - $('#nextcloud').width()) * usePercentualAppMenuLimit); + var minAppsDesktop = 8; + var availableWidth = headerWidth - $(appList).width(); + var isMobile = $(window).width() < 768; + if (!isMobile) { + availableWidth = headerWidth * usePercentualAppMenuLimit; + } var appCount = Math.floor((availableWidth / $(appList).width())); + if (isMobile && appCount > minAppsDesktop) { + appCount = minAppsDesktop; + } + if (!isMobile && appCount < minAppsDesktop) { + appCount = minAppsDesktop; + } + // show at least 2 apps in the popover if(appList.length-1-appCount >= 1) { appCount--;