Untitled

mail@pastecode.io avatar
unknown
plain_text
14 days ago
838 B
1
Indexable
Never
 document.addEventListener('DOMContentLoaded', function() {
      const menuItems = document.querySelectorAll('.reset .image-hover');
       
      menuItems.forEach(item => {
        item.addEventListener('mouseover', function() {
           const title = item.getAttribute('title');
        
          if (testData[title]) {
            const dynamicImage = document.querySelector('.megamenu .container .row .categories .new-div-class img');
            dynamicImage.src = testData[title];
          }
        });

        item.addEventListener('mouseout', function() {
          // Reset the src attribute of the dynamic image to an empty string on mouseout
          const dynamicImage = document.querySelector('.megamenu .container .row .categories .new-div-class img');
          dynamicImage.src = "";
        });
      });
    });
Leave a Comment