Untitled

 avatar
unknown
plain_text
3 years ago
1.6 kB
6
Indexable
(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";

    /* all Pure helper functions */

    function waitForElement(selector, trigger, delayInterval, delayTimeout) {
      var interval = setInterval(function () {
        if (
          document &&
          document.querySelector(selector) &&
          document.querySelectorAll(selector).length > 0
        ) {
          clearInterval(interval);
          trigger();
        }
      }, delayInterval);
      setTimeout(function () {
        clearInterval(interval);
      }, delayTimeout);
    }

    /* Variation functions */
   
function init(){

  const eg_links = document.querySelector("div#mega-menu-dropdown #level-2-1").children;

// for (link of eg_links) {
//   let anchor = link.children[0];
//   if (anchor) {
//       anchor.addEventListener("click", (e) => {
//           window.location.href = anchor.href;
//       });
//   }
// }

let anchor = document.querySelectorAll("#level-2-1 > li > a")
for (let a of anchor) {
    a.addEventListener("click" , function(){
       window.location.href = this.href
    })}

}
    /* Initialize variation */
    waitForElement("body nav.navbar", init, 50, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();




html body nav.navbar {
    position: fixed;
    top: 0px;
    z-index: 9999;
}
@media screen and (min-width: 992px){
html body {
    padding-top: 120px;
}
}
@media screen and (max-width: 991px){
html body {
    padding-top: 90px;
}
}

Editor is loading...