-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
33 lines (29 loc) · 982 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import 'bootstrap'
import $ from 'jquery'
import style from './css/style.scss'
let found = false
$(() => {
const isMarkerFound = () => found
const setMarkerFound = (s) => { found = s }
const gotoVideo = () => {
$("a-marker").each((index, marker) => {
if (marker.object3D.visible) {
if (isMarkerFound()) return
setMarkerFound(true)
$("#media-popup").find("iframe").attr("src", $(marker).data('video'))
$("body").addClass("show-popup")
}
})
requestAnimationFrame(gotoVideo)
}
requestAnimationFrame(gotoVideo)
$(".popup").on("click", e => {
e.preventDefault()
e.stopPropagation()
$("body").removeClass("show-popup")
$("#media-popup").find("iframe").attr("src", '')
setMarkerFound(false)
requestAnimationFrame(gotoVideo)
})
$(".popup > iframe").on("click", e => { e.stopPropagation() })
})