Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
1
Indexable
Never
(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";
    var $;
    /* 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);
    }

   let egContct = `<div class="hero__cta egCTA">
<a  class="btn egBtn">START PLANNING</a>
</div>`;
    
    /* Variation Init */
    function init() {
      /* start your code here */
      document.querySelector("section > div > div.hero__text > div:nth-child(2)").insertAdjacentHTML("afterend" , egContct);
      document.querySelector(".egBtn").addEventListener("click" , function() {
        document.querySelector("#main-nav div.region button.cta-form").click();
      })
    };

    /* Initialize variation */
    waitForElement('section > div > div.hero__text > div:nth-child(2)', init, 50, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();


.egBtn {
    padding-inline: 30px;
    border: 1px solid #fff;
    color: #fff;
    letter-spacing: 2px;
}

.egBtn:hover {
    background: #fff;
}
@media (min-width: 992px) and (max-height: 860px){
html .page-node-type-op-page .hero--featured .hero__text {
    padding-top: 8em;
}
}