code

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.7 kB
7
Indexable
Never
(function() {
  var debug = 0;
  var variation_name = "";
  if (window.location.href.indexOf('qa-debug=true') > -1) {
      debug = 1;
  }
  try {
      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);
      }


      function init() {
          if (debug) {
              console.log('Inside init Function');
          }
                window.addEventListener('scroll', function() {
                  if (window.scrollY > 363 ) {
                    document.querySelector('body').classList.add('kb-sticky-filter');
                  } else {
                    document.querySelector('body').classList.remove('kb-sticky-filter');
                  }
                });

      }

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



//CSS


.kb-sticky-filter .page__filters--mobile {
  position: fixed;
  top: 0px;
  display: inline-block;
  width: 100%;
  margin: auto;
  z-index: 999;
  margin-left:-1.5rem;
}

.kb-sticky-filter .page__filters--mobile .facets__intro .btn-secondary{
  height: 3rem!important;
}

.kb-sticky-filter .list-inline.facet__summary{
  display:none
}