Skip to content

Commit 4219985

Browse files
committed
Fix body scrolling in published page
Signed-off-by: Yukai Huang <[email protected]>
1 parent 62bbf92 commit 4219985

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

public/js/lib/renderer/lightbox/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function findOrCreateLightboxContainer () {
2424
const hideContainer = (e) => {
2525
e.stopPropagation()
2626
lightBoxContainer.classList.remove('show')
27+
document.body.classList.remove('no-scroll')
2728
}
2829

2930
lightBoxContainer.querySelector('.lightbox-control-previous').addEventListener('click', (e) => {
@@ -71,6 +72,7 @@ function onClickImage (img) {
7172
setImageInner(img, lightBoxContainer)
7273

7374
lightBoxContainer.classList.add('show')
75+
document.body.classList.add('no-scroll')
7476

7577
currentImage = img
7678
updateLightboxImages()

public/js/lib/renderer/lightbox/lightbox.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@
6262
.markdown-body img.md-image {
6363
cursor: zoom-in;
6464
}
65+
66+
body.no-scroll {
67+
overflow: hidden;
68+
}

0 commit comments

Comments
 (0)