feat: auto play video
This commit is contained in:
parent
9e186ab974
commit
53c8483a3f
3 changed files with 62 additions and 50 deletions
|
|
@ -11,3 +11,13 @@ export function isSafari() {
|
|||
const vendor = window.navigator.vendor
|
||||
return /Safari/.test(ua) && /Apple Computer/.test(vendor) && !/Chrome/.test(ua)
|
||||
}
|
||||
|
||||
export function isInViewport(el: HTMLElement) {
|
||||
const rect = el.getBoundingClientRect()
|
||||
return (
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||||
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue