diff options
author | Julius Härtl <jus@bitgrid.net> | 2017-06-14 11:08:45 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-06-15 10:55:17 +0200 |
commit | 02a63e94289286f7d95d2adb31bb034e00127cb8 (patch) | |
tree | ec8e9d575bd37951292f1d3de3dc7e397cc59333 | |
parent | 073d5dbc85906da8cf0fc7556ada4fbbe8ce0db0 (diff) | |
download | nextcloud-server-02a63e94289286f7d95d2adb31bb034e00127cb8.tar.gz nextcloud-server-02a63e94289286f7d95d2adb31bb034e00127cb8.zip |
Show at least 8 icons, don't use percentage on mobile
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | core/js/js.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js index 80b36bad053..2aa7bf1bc55 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--; |