mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 01:00:50 -04:00
Merge pull request #5244 from nextcloud/dynamic-percentual-appmenu-limit
Now using dynamic percentual appmenu limit
This commit is contained in:
commit
fc47d0bbaa
1 changed files with 20 additions and 2 deletions
|
|
@ -1512,12 +1512,30 @@ function initCore() {
|
|||
|
||||
var resizeMenu = function() {
|
||||
var appList = $('#appmenu li');
|
||||
var availableWidth = $('#header-left').width() - $('#nextcloud').width() - 44;
|
||||
var appCount = Math.floor((availableWidth)/44);
|
||||
var headerWidth = $('#header-left').width() - $('#nextcloud').width()
|
||||
var usePercentualAppMenuLimit = 0.33;
|
||||
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--;
|
||||
}
|
||||
// show at least one icon
|
||||
if(appCount < 1) {
|
||||
appCount = 1;
|
||||
}
|
||||
|
||||
$('#more-apps a').removeClass('active');
|
||||
var lastShownApp;
|
||||
|
|
|
|||
Loading…
Reference in a new issue