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-14 11:14:04 +0200 |
commit | cec2893d3bd35ef0a99ec832c241e7a516f5da14 (patch) | |
tree | aeb99d096a7174a4fa7031ca1bbc381151e7b439 /core/js | |
parent | c0c5df31c08d6a4927a3d0128007a51d73a744b4 (diff) | |
download | nextcloud-server-cec2893d3bd35ef0a99ec832c241e7a516f5da14.tar.gz nextcloud-server-cec2893d3bd35ef0a99ec832c241e7a516f5da14.zip |
Show at least 8 icons, don't use percentage on mobile
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/js')
-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 7264198dc8c..8f16d02f96f 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--; |