diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index 082cd1c9..cff41405 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -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); + } + }, }); } diff --git a/app/static/structure.css b/app/static/structure.css index 6e629e8e..bac7cc7a 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -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 */ diff --git a/app/static/structure.scss b/app/static/structure.scss index ab3ec93e..066110c8 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -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; }