Untitled

 avatar
unknown
plain_text
a year ago
838 B
4
Indexable
 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 = "";
        });
      });
    });
Editor is loading...
Leave a Comment