Show at least 8 icons, don't use percentage on mobile

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2017-06-14 11:08:45 +02:00
parent 073d5dbc85
commit 02a63e9428
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 14 additions and 1 deletions

View File

@ -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--;