Fix body scrolling in published page

Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
Yukai Huang 2020-04-19 20:59:49 +08:00
parent 62bbf928b7
commit 4219985658
2 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,7 @@ function findOrCreateLightboxContainer () {
const hideContainer = (e) => {
e.stopPropagation()
lightBoxContainer.classList.remove('show')
document.body.classList.remove('no-scroll')
}
lightBoxContainer.querySelector('.lightbox-control-previous').addEventListener('click', (e) => {
@ -71,6 +72,7 @@ function onClickImage (img) {
setImageInner(img, lightBoxContainer)
lightBoxContainer.classList.add('show')
document.body.classList.add('no-scroll')
currentImage = img
updateLightboxImages()

View File

@ -62,3 +62,7 @@
.markdown-body img.md-image {
cursor: zoom-in;
}
body.no-scroll {
overflow: hidden;
}