I am working on my portfolio and I have an issue with the touch event.
It works fine only the first element when classes are selected with querySelector but when I want to make the code work for other elements and I select classes with querySelectorAll the holde code stops working.
Here is the HTML:
Here is the JS: (The code that works)
[code]const card = document.querySelector(‘.t-card’);
const hidden = document.querySelector(‘.hidden-img’);
card.addEventListener(‘touchstart’, ()=> {
hidden.classList.toggle(‘tap-show’);
});
const cardB = document.querySelector(‘.card-container’);
const businessCard = document.querySelector(‘.card’);
cardB.addEventListener(‘touchstart’, ()=> {
businessCard.classList.toggle(‘tap-turn’);
});