card.forEach( (itemCard, index) => {
itemCard.addEventListener('click', (item) => {
cardPopup.classList.remove('active');
setTimeout(() => {
cardPopup.classList.add('active')
cardPopup.innerHTML = `
<div class="card__popup-close" onclick="cardPopupCloseFun()"></div>
<div class="card__popup-image">
<img src="${arrayOfCards[index].image}" alt="">
</div>
<div class="card__popup-info">
<h2 class="card__popup-name">${arrayOfCards[index].name}</h2>
<p class="card__popup-title">${arrayOfCards[index].title}</p>
</div>
`;
}, 300)
})
})
+const opacResume = debounce( () => elem.classList.remove('animate-opacity'), 500 );
window.addEventListener('scroll', function () {
- if(this.pageYOffset >= posTop) {
- } else {
elem.classList.remove('animate-opacity');
- }
+ opacResume();
}, false);