diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index 609db8c2..082cd1c9 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -88,9 +88,40 @@ function setupLightboxGallery() { function setupLightboxTeaser() { baguetteBox.run('.post_teaser', { fullScreen: false, + noScrollbars: true, async: true, 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.addEventListener('popstate', popStateListener); + + function baguetteBoxClickImg(event) { + if (this.style.width != "100vw" && this.offsetWidth < window.innerWidth) { + this.style.width = "100vw"; + this.style.maxHeight = "none"; + } else { + this.style.width = ""; + this.style.maxHeight = ""; + this.removeEventListener('click', baguetteBoxClickImg); + baguetteBox.hide(); + } + }; + for (const el of document.querySelectorAll('div#baguetteBox-overlay img')) { + el.addEventListener('click', baguetteBoxClickImg); + } + }, }); } diff --git a/app/static/structure.css b/app/static/structure.css index 12684ceb..6e629e8e 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -1427,4 +1427,20 @@ h1 .warning_badge { word-wrap: break-word; } +#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; +} + /*# sourceMappingURL=structure.css.map */ diff --git a/app/static/structure.scss b/app/static/structure.scss index 7a62e7bc..ab3ec93e 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -1104,3 +1104,19 @@ h1 .warning_badge { .post_body, .comment_body { word-wrap: break-word; } + +#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%; +} diff --git a/app/templates/base.html b/app/templates/base.html index 21bc3569..6e66c45f 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -28,7 +28,7 @@ {% block head -%} - +