I am trying to get multiple different circles to do this transition, but only the first one will trigger the effect (regardless of where the rest are on the page)
javascript
let circle = document.querySelector('.circle')
circle.addEventListener('mouseenter', () => {
if(!circle.classList.contains('hover')){
circle.classList.add('hover');
}
})
circle.addEventListener('mouseleave', () =>{
if(circle.classList.contains('hover')){
circle.classList.remove('hover');
}
})
css
.circle {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
width: 100px;
background: slateblue;
border-radius: 100px;
font-size: 1.5rem;
color: #fff;
cursor: pointer;
transition: cubic-bezier(0.075, 0.82, 0.165, 1) 3s;
}
.hover {
transform: scale(1.5);
}
html
<div class="circle">1</div>
<div class="circle">2</div>