Skip to content

Commit d754579

Browse files
committed
feat: using class
1 parent 7929fc9 commit d754579

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/script.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export default {
5858
timer: null,
5959

6060
beginThumbIndex: 0,
61-
62-
docStyleOverflow: document && document.getElementsByTagName('body')[0].style.overflow,
6361
}
6462
},
6563

@@ -126,9 +124,9 @@ export default {
126124
lightBoxOn(value) {
127125
if (document != null) {
128126
if (value) {
129-
document.getElementsByTagName('body')[0].style.overflow = 'hidden'
127+
document.getElementsByTagName('body')[0].classList.add('vue-lb-open')
130128
} else {
131-
document.getElementsByTagName('body')[0].style.overflow = this.docStyleOverflow
129+
document.getElementsByTagName('body')[0].classList.remove('vue-lb-open')
132130
}
133131
}
134132
},

src/components/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,7 @@ img.vue-lb-modal-image {
232232
}
233233
}
234234

235+
.vue-lb-open {
236+
overflow: hidden;
237+
}
238+

0 commit comments

Comments
 (0)