mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 20:29:08 +01:00
fix: autoplay video only when on screen (#624)
This commit is contained in:
parent
4787250df0
commit
121c90fc3a
1 changed files with 3 additions and 3 deletions
|
@ -66,12 +66,12 @@ useIntersectionObserver(video, (entries) => {
|
||||||
return
|
return
|
||||||
|
|
||||||
entries.forEach((entry) => {
|
entries.forEach((entry) => {
|
||||||
if (entry.intersectionRatio !== 1 && !video.value!.paused)
|
if (entry.intersectionRatio <= 0.75)
|
||||||
video.value!.pause()
|
!video.value!.paused && video.value!.pause()
|
||||||
else
|
else
|
||||||
video.value!.play()
|
video.value!.play()
|
||||||
})
|
})
|
||||||
}, { threshold: 1 })
|
}, { threshold: 0.75 })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in a new issue