{"version":3,"sources":["20221114GreenWeek_functions.js"],"names":["sliderForestWrapper","document","querySelector","swiper","Swiper","init","swiperMode","mobile","window","matchMedia","desktop","matches","slidesPerView","spaceBetween","freeMode","pagination","el","type","navigation","nextEl","prevEl","classList","remove","destroy","add","addEventListener","sliderOutdoors","breakpoints","600","900","1200","1480","sliderSlot","getElementById","catLandingMiddle","appendChild"],"mappings":"AAmGA,IAAMA,oBAAsBC,SAASC,cAAc,iCAE/CC,OAAQC,OACRC,MAAO,EAEX,SAASC,aACP,IAAIC,EAASC,OAAOC,WAAW,2CAC3BC,EAAUF,OAAOC,WAAW,sBAE5BF,EAAOI,SACJN,OACHA,MAAO,EACPF,OAAS,IAAIC,OAAO,gBAAiB,CACnCQ,cAAe,EACfC,aAAc,GACdC,UAAU,EACVC,WAAY,CACVC,GAAI,qBACJC,KAAM,YAERC,WAAY,CACVC,OAAQ,uBACRC,OAAQ,2BAIdpB,oBAAoBqB,UAAUC,OAAO,qBAAsB,4BAA6B,mBAGjFZ,EAAQC,UACXN,OACFA,MAAO,EACPF,OAAOoB,SAAQ,GAAM,IAEvBvB,oBAAoBqB,UAAUG,IAAI,qBAAsB,4BAA6B,mBAIzFhB,OAAOiB,iBAAiB,OAAQ,WAC9BnB,eAGFE,OAAOiB,iBAAiB,SAAU,WAChCnB,eAIF,IAAMoB,eAAiB,IAAItB,OAAO,kBAAmB,CACnDQ,cAAe,EACfC,aAAc,GACdC,UAAU,EACVa,YAAa,CACXC,IAAK,CACHhB,cAAe,EACfC,aAAc,IAEhBgB,IAAK,CACHhB,aAAc,IAEhBiB,KAAM,CACJlB,cAAe,KAEjBmB,KAAM,CACJnB,cAAe,MASfoB,WAAa/B,SAASgC,eAAe,kBACrCC,iBAAmBjC,SAASgC,eAAe,sBACjDC,kBAAoBF,WAAWG,YAAYD","file":"20221114GreenWeek_functions.min.js","sourcesContent":["// TOUCH OR NO-TOUCH, THAT IS THE QUESTION!\r\n// SCROLL-TO ANIMATION FOR ANCHOR LINKS\r\n// FADE-IN-UP ELEMENTS ON SCROLL\r\n// SLIDER (SWIPER JS)\r\n// SLIDER (SLICK JS)\r\n// PRODUCT PICKER\r\n// NEWSLETTER PICKER\r\n\r\n\r\n\r\n//\r\n// =TOUCH OR NO-TOUCH, THAT IS THE QUESTION!\r\n// --------------------------------------------------\r\n\r\n// function isTouchDevice() {\r\n//   return true == (\"ontouchstart\" in window || window.DocumentTouch && document instanceof DocumentTouch);\r\n// }\r\n// if (isTouchDevice() === true) {\r\n//   $(\"body\").toggleClass(\"touch\");\r\n// } else {\r\n//   $(\"body\").toggleClass(\"no-touch\");\r\n// }\r\n\r\n\r\n//\r\n// =SCROLL-TO ANIMATION FOR ANCHOR LINKS\r\n// --------------------------------------------------\r\n\r\n// $('.msdw-page-scroll').click(function() {\r\n//   if (location.pathname.replace(/^\\//,'') == this.pathname.replace(/^\\//,'') && location.hostname == this.hostname) {\r\n//     var target = $(this.hash);\r\n//     target = target.length ? target : $('[name=' + this.hash.slice(1) +']');\r\n//     if (target.length) {\r\n//       var offsetValue = 0;\r\n//       if ( window.innerWidth <= 767 ) {\r\n//         offsetValue;\r\n//         // console.log(offsetValue);\r\n//       } else {\r\n//         offsetValue = 59;\r\n//         // console.log(offsetValue);\r\n//       }\r\n\r\n//       $('html,body').animate({\r\n//         scrollTop: target.offset().top - offsetValue\r\n//       }, 900);\r\n//       return false;\r\n//     }\r\n//   }\r\n// });\r\n\r\n\r\n//\r\n// =FADE-IN-UP ELEMENTS ON SCROLL\r\n// --------------------------------------------------\r\n\r\n// *** IntersectionObserver ***\r\n\r\n// const elements = document.querySelectorAll(\".msdw-animate\");\r\n\r\n// function check(entries) {\r\n//   entries.map((entry) => {\r\n//     if (entry.isIntersecting) {\r\n//       entry.target.classList.add(\"msdw-animated\");\r\n//       observer.unobserve(entry.target);\r\n//     }\r\n//   });\r\n// }\r\n\r\n// const observer = new IntersectionObserver(check);\r\n\r\n// elements.forEach((elem) => observer.observe(elem));\r\n\r\n\r\n// *** requestAnimationFrame ***\r\n\r\n// const scroll = window.requestAnimationFrame;\r\n\r\n// function showOnScroll() {\r\n//   const elems = document.querySelectorAll('.msdw-animate');\r\n\r\n//   elems.forEach((el) => {\r\n//     const elPosition = el.getBoundingClientRect().top\r\n//     const elScreen = window.innerHeight / .9\r\n\r\n//     if (elPosition < elScreen) {\r\n//       el.classList.add('msdw-animated')\r\n//     }\r\n//   });\r\n\r\n//   scroll(showOnScroll);\r\n// }\r\n\r\n// showOnScroll();\r\n\r\n\r\n//\r\n// =SLIDER (SWIPER JS)\r\n// --------------------------------------------------\r\n\r\nconst sliderForestWrapper = document.querySelector('#sliderForest .swiper-wrapper');\r\n\r\nlet swiper= Swiper;\r\nlet init = false;\r\n\r\nfunction swiperMode() {\r\n  let mobile = window.matchMedia('(min-width: 0px) and (max-width: 899px)');\r\n  let desktop = window.matchMedia('(min-width: 900px)');\r\n\r\n  if (mobile.matches) {\r\n    if (!init) {\r\n      init = true;\r\n      swiper = new Swiper('#sliderForest', {\r\n        slidesPerView: 1,\r\n        spaceBetween: 10,\r\n        freeMode: true,\r\n        pagination: {\r\n          el: \".swiper-pagination\",\r\n          type: \"fraction\",\r\n        },\r\n        navigation: {\r\n          nextEl: \".swiper-button--next\",\r\n          prevEl: \".swiper-button--prev\",\r\n        },\r\n      });\r\n    }\r\n    sliderForestWrapper.classList.remove('jws-grid-container', 'jws-grid-container-gutter', 'jwsdw-flexGrid');\r\n  }\r\n\r\n  else if (desktop.matches) {\r\n    if (init) {\r\n      init = false;\r\n      swiper.destroy(true, true);\r\n    }\r\n    sliderForestWrapper.classList.add('jws-grid-container', 'jws-grid-container-gutter', 'jwsdw-flexGrid');\r\n  }\r\n}\r\n\r\nwindow.addEventListener('load', function () {\r\n  swiperMode();\r\n});\r\n\r\nwindow.addEventListener('resize', function () {\r\n  swiperMode();\r\n});\r\n\r\n\r\nconst sliderOutdoors = new Swiper('#sliderOutdoors', {\r\n  slidesPerView: 1,\r\n  spaceBetween: 10,\r\n  freeMode: true,\r\n  breakpoints: {\r\n    600: {\r\n      slidesPerView: 2,\r\n      spaceBetween: 15,\r\n    },\r\n    900: {\r\n      spaceBetween: 20,\r\n    },\r\n    1200: {\r\n      slidesPerView: 2.5,\r\n    },\r\n    1480: {\r\n      slidesPerView: 3,\r\n    },\r\n  },\r\n});\r\n\r\n\r\n//\r\n// =PLACE SLOT MODULE INSIDE THE LP\r\n// --------------------------------------------------\r\nconst sliderSlot = document.getElementById('msdwSlidetSlot');\r\nconst catLandingMiddle = document.getElementById('cat-landing-middle');\r\ncatLandingMiddle && sliderSlot.appendChild(catLandingMiddle);"]}