Skip to content

Commit 01aed53

Browse files
Jinjiangchrisvfritz
authored andcommitted
Fixed js error when click the page (#1401)
1 parent e6ac092 commit 01aed53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: themes/vue/source/js/common.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,24 @@
155155
var player = new Vimeo.Player(iframe)
156156
var overlay = document.createElement('div')
157157
overlay.className = 'overlay'
158+
var isOpen = false
158159

159160
modalButton.addEventListener('click', function(event) {
160161
event.stopPropagation()
161162
videoModal.classList.toggle('open')
162163
document.body.classList.toggle('stop-scroll')
163164
document.body.appendChild(overlay)
164165
player.play()
166+
isOpen = true
165167
})
166168

167169
document.body.addEventListener('click', function(e) {
168-
if (e.target !== modalButton && !videoModal.contains(e.target)) {
170+
if (isOpen && e.target !== modalButton && !videoModal.contains(e.target)) {
169171
videoModal.classList.remove('open')
170172
document.body.classList.remove('stop-scroll')
171173
document.body.removeChild(overlay)
172174
player.unload()
175+
isOpen = false
173176
}
174177
})
175178
}

0 commit comments

Comments
 (0)