fix lightbox (again)

This commit is contained in:
Hendrik L 2024-07-05 00:35:48 +02:00
parent bd3da38ff9
commit 0623b445e6
3 changed files with 12 additions and 38 deletions

View file

@ -86,6 +86,9 @@ function setupLightboxGallery() {
function setupLightboxTeaser() {
function popStateListener(event) {
baguetteBox.hide();
}
baguetteBox.run('.post_teaser', {
fullScreen: false,
noScrollbars: true,
@ -93,18 +96,7 @@ function setupLightboxTeaser() {
preload: 3,
ignoreClass: 'preview_image',
afterShow: function() {
var backButtonPrevented = false;
history.pushState(null, document.title, location.href);
function popStateListener(event) {
if (backButtonPrevented === false){
history.pushState(null, document.title, location.href);
baguetteBox.hide();
backButtonPrevented = true;
} else {
window.removeEventListener('popstate', popStateListener);
history.back();
}
}
window.history.pushState('#lightbox', document.title, document.location+'#lightbox');
window.addEventListener('popstate', popStateListener);
function baguetteBoxClickImg(event) {
@ -122,6 +114,12 @@ function setupLightboxTeaser() {
el.addEventListener('click', baguetteBoxClickImg);
}
},
afterHide: function() {
if (window.history.state === '#lightbox') {
window.history.back();
window.removeEventListener('popstate', popStateListener);
}
},
});
}

View file

@ -1428,19 +1428,7 @@ h1 .warning_badge {
}
#baguetteBox-overlay {
overflow: scroll !important;
}
#baguetteBox-overlay .full-image {
height: auto !important;
}
#baguetteBox-overlay .full-image figure {
display: inline-block !important;
}
#baguetteBox-slider {
height: auto !important;
overflow: scroll;
}
/*# sourceMappingURL=structure.css.map */

View file

@ -1106,17 +1106,5 @@ h1 .warning_badge {
}
#baguetteBox-overlay {
overflow: scroll !important;
.full-image {
height: auto !important;
//min-height: 100%;
figure {
display: inline-block !important;
}
}
}
#baguetteBox-slider {
height: auto !important;
//min-height: 100%;
overflow: scroll;
}