Skip to content
Snippets Groups Projects
Commit 85f6c059 authored by Alexander Purr's avatar Alexander Purr Committed by Mathias Maaß
Browse files

refs #25980 [fid_adlr] js for resizing content area if getitbox (incl....

refs #25980 [fid_adlr] js for resizing content area if getitbox (incl. notices) are growing or shrinking
* replace DOMSubtreeModified event by MutationObserver
* move resizing into own function
** use .mainbody as reference element instead of .media
** consider padding of .mainbody for (re)calculating new min-width
** recalculate min-width of .mainbody on each call
parent 9156cb90
Branches
Tags instance/fid_adlr/alpha/oldindex
No related merge requests found
......@@ -15,7 +15,7 @@
* - remove record-tabs
* - add back-to-search-link
* - remove sidebar
* - add specific JS to prevent get-it-box to protrude into footer #19260, #17831
* - add specific JS to prevent get-it-box to protrude into footer #19260, #17831, #25980
* -- newsletter usage
*
* configured in: --
......@@ -86,18 +86,25 @@
<?= $this->inlineScript(\Laminas\View\Helper\HeadScript::SCRIPT, '$(document).ready(recordDocReady);', 'SET'); ?>
<?php /* fid_adlr: specific JS to prevent get-it-box to protrude into footer #19260, #17831 */ ?>
<?php /* fid_adlr: specific JS to prevent get-it-box to protrude into footer #19260, #17831, #25980 */ ?>
<?php // fid_adlr: see jQuery Dimensions: https://www.w3schools.com/jquery/jquery_dimensions.asp ?>
<?php $script = <<<JS
$(document).ready(function() {
$("body").on('DOMSubtreeModified', ".getitbox", function (){
if ($(window).width() >= 1200) {
var contentHeight = $('.media').height();
var getitboxHeight = $('.getitbox').height();
if (getitboxHeight > contentHeight) {
$('.media').css('min-height', getitboxHeight+'px');
}
function resizeContentHeight() {
if ($(window).width() >= 1200) {
var getitbox = $('.getitbox');
var getitboxHeight = getitbox.height();
var content = $('.mainbody');
var contentAddition = content.outerHeight() - content.height();
content.css('min-height', Number(getitboxHeight + contentAddition)+'px');
}
})
}
$(document).ready(function() {
resizeContentHeight();
new MutationObserver(() => resizeContentHeight())
.observe(
$('.getitbox')[0],
{ subtree: true, childList: true}
);
});
JS;
?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment