Update events

This commit is contained in:
Dennis Reimann
2022-04-21 09:05:28 +02:00
parent f4cc231089
commit ba0d2dabbe
8 changed files with 131 additions and 23 deletions

View File

@@ -95,4 +95,16 @@ document.addEventListener("DOMContentLoaded", () => {
link.parentNode.parentNode.classList.add('expanded')
})
})
// Video
document.querySelectorAll('.ytEmbed').forEach(video => {
video.addEventListener('click', e => {
e.preventDefault()
const lazyAttr = 'data-src'
const iframe = e.target.querySelector(`iframe[${lazyAttr}]`)
if (iframe) {
const src = iframe.setAttribute('src', iframe.getAttribute(lazyAttr))
}
})
})
})