collapsible.js: Don't collapse containers which are near to the maximum

This commit is contained in:
Johannes Meyer 2019-06-28 08:29:01 +02:00
parent c5ebaa2bde
commit fc782b59a9
1 changed files with 10 additions and 1 deletions

View File

@ -101,7 +101,16 @@
if (!! rowSelector) {
return $(rowSelector, $collapsible).length > ($collapsible.data('visibleRows') || this.defaultVisibleRows);
} else {
return $collapsible.innerHeight() > ($collapsible.data('visibleHeight') || this.defaultVisibleHeight);
var actualHeight = $collapsible.innerHeight(),
maxHeight = $collapsible.data('visibleHeight') || this.defaultVisibleHeight;
if (actualHeight <= maxHeight) {
return false;
}
// Although the height seems larger than what it should be, make sure it's not just a small fraction
// i.e. more than 12 pixel and at least 10% difference
return actualHeight - maxHeight > 12 && actualHeight / maxHeight >= 1.1;
}
};