/*
 * Image hover swap
 */
function valueSwap(v1, v2) {
    return [v2, v1]
}

const productItemImages = document.querySelectorAll('.product__with-img-swap')

productItemImages.forEach(productItemImage => {
    productItemImage.addEventListener('mouseover', event => {
        [event.target.src, event.target.dataset.altimgSrc] = valueSwap(event.target.src, event.target.dataset.altimgSrc)
    })
    productItemImage.addEventListener('mouseout', event => {
        [event.target.src, event.target.dataset.altimgSrc] = valueSwap(event.target.src, event.target.dataset.altimgSrc)
    })
})
