GrassClipper/resources/js/hoverEvt.js

21 lines
584 B
JavaScript
Raw Normal View History

document.addEventListener('DOMContentLoaded', async () => {
const firstHalf = document.querySelector('#firstHalf')
const secondHalf = document.querySelector('#secondHalf')
// Listen to hovers
firstHalf.addEventListener('mouseover', () => {
secondHalf.classList.add('darken')
})
firstHalf.addEventListener('mouseout', () => {
secondHalf.classList.remove('darken')
})
secondHalf.addEventListener('mouseover', () => {
firstHalf.classList.add('darken')
})
secondHalf.addEventListener('mouseout', () => {
firstHalf.classList.remove('darken')
})
})