Hi Armin! I appreciate you like the website and thanks for the reply. Just found time to try and fix the error, but it just wont work.
this is the code i came up with now:
document.addEventListener("DOMContentLoaded", function() {
var burgerContainer = document.querySelector('.overlay-burger.custom-overlay-burger.burger-overlay-id-73');
var burgerIcon = burgerContainer.querySelector('img');
var originalSrc = burgerIcon.src; // Original burger icon
var toggleSrc = 'https://www.jasonkittner.com/wp-content/uploads/2024/10/Burger2.png'; // URL of the 'X' icon
// Image toggle functionality and adding classes to the container
burgerContainer.addEventListener('click', function() {
if (burgerIcon.src.includes(originalSrc)) {
burgerIcon.src = toggleSrc;
burgerContainer.classList.add('overlay-close'); // Add the classes to the container
} else {
burgerIcon.src = originalSrc;
burgerContainer.classList.remove('overlay-close'); // Remove the classes from the container
}
});
});