Newer
Older
pre-www / src / assets / js / blocks / tease.js
window.addEventListener('load', (event) => {

    const teaseItems = document.querySelectorAll('[data-tease-cover]')

    function updateTeaseHeight(tease){
        const teaseHeight = tease.clientHeight
        const teaseImg = tease.querySelector('.tease__img')
        const teaseText = tease.querySelector('.tease__main')
        const teaseTextHeight = teaseText.clientHeight
        teaseImg.style.height = `${teaseHeight-teaseTextHeight}px`
        teaseText.style.marginTop = `${teaseHeight-teaseTextHeight}px`
    }

    teaseItems.forEach(tease => {
        updateTeaseHeight(tease)        
    })

    window.addEventListener('resize', function(){
        teaseItems.forEach(tease => {
            updateTeaseHeight(tease)
        })    
    })


})