Skip to content

Commit

Permalink
Merge pull request #4149 from IgorA100/patch-87725
Browse files Browse the repository at this point in the history
Fix: isOutOfViewport calculation of the block bottom for sticky mode & change calculation "out.all" on Montage page
  • Loading branch information
connortechnology authored Sep 23, 2024
2 parents da4636d + 016524b commit 53df3a6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/skins/classic/views/js/montage.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ function initPage() {

document.addEventListener('scrollend', on_scroll); // for non-sticky
document.getElementById('content').addEventListener('scrollend', on_scroll);
window.addEventListener('resize', on_scroll);
} // end initPage

function on_scroll() {
Expand All @@ -860,12 +861,16 @@ function isOutOfViewport(elem) {

// Check if it's out of the viewport on each side
const out = {};
out.top = (bounding.top < headerHeight) || ( bounding.top > (window.innerHeight || document.documentElement.clientHeight) );
out.topUp = (bounding.top < headerHeight);
out.topDown = ( bounding.top > (window.innerHeight || document.documentElement.clientHeight) );
out.top = (out.topUp || out.topDown);
out.left = (bounding.left < 0) || (bounding.left > (window.innerWidth || document.documentElement.clientWidth));
out.bottom = (bounding.bottom > (window.innerHeight-headerHeight || document.documentElement.clientHeight-headerHeight) ) || (bounding.bottom < 0);
out.bottomUp = (bounding.bottom < headerHeight);
out.bottomDown = (bounding.bottom > (window.innerHeight-headerHeight || document.documentElement.clientHeight-headerHeight) );
out.bottom = (out.bottomUp || out.bottomDown);
out.right = (bounding.right > (window.innerWidth || document.documentElement.clientWidth) ) || (bounding.right < 0);
out.any = out.top || out.left || out.bottom || out.right;
out.all = (out.top && out.bottom ) || (out.left && out.right);
out.all = (out.topUp && out.bottomUp ) || (out.topDown && out.bottomDown ) || (out.left && out.right);
//console.log( 'top: ' + out.top + ' left: ' + out.left + ' bottom: '+out.bottom + ' right: '+out.right);

return out;
Expand Down

0 comments on commit 53df3a6

Please sign in to comment.