Untitled

mail@pastecode.io avatar
unknown
plain_text
8 days ago
838 B
2
Indexable
Never
(function () {
  // Function to wait for an element to appear before proceeding
  function waitForElement(selector, trigger, delayInterval, delayTimeout) {
    var interval = setInterval(function () {
      if (document && document.querySelector(selector)) {
        clearInterval(interval);
        trigger();
      }
    }, delayInterval);
    setTimeout(function () {
      clearInterval(interval);
    }, delayTimeout);
  }

  function swapSections() {
    const topSection = document.querySelector('.product__accordion_custom');
    const ulElement = document.querySelector('.show-on-mob .show-desk:first-of-type');

    if (topSection && ulElement) {
      topSection.insertAdjacentElement('beforebegin', ulElement);
    }
  }

  waitForElement('.product__accordion_custom', swapSections, 50, 15000);
})();
Leave a Comment