app.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. // lightbox
  2. // let gallery = new SimpleLightbox('.gallery a', {});
  3. // gallery.on('show.simplelightbox', function () {
  4. // // do something…
  5. // });
  6. // lightbox end
  7. // product details carousel
  8. // var galleryThumbs = new Swiper('.gallery-thumbs', {
  9. // loop: true,
  10. // loopedSlides: 1,
  11. // spaceBetween: 10,
  12. // slidesPerView: 2,
  13. // direction: 'vertical',
  14. // // centeredSlides: true,
  15. // freeMode: true,
  16. // breakpoints: {
  17. // 0: {
  18. // direction: 'horizontal',
  19. // spaceBetween: 5,
  20. // slidesPerView: 4,
  21. // centeredSlides: true,
  22. // },
  23. // 993: {
  24. // direction: 'vertical',
  25. // spaceBetween: 15,
  26. // slidesPerView: 4,
  27. // }
  28. // }
  29. // });
  30. // var galleryTop = new Swiper('.gallery-main', {
  31. // loop: true,
  32. // spaceBetween: 10,
  33. // loopedSlides: 1,
  34. // centeredSlides: true,
  35. // freeMode: true,
  36. // navigation: {
  37. // nextEl: '.swiper-button-next',
  38. // prevEl: '.swiper-button-prev',
  39. // },
  40. // thumbs: {
  41. // swiper: galleryThumbs,
  42. // },
  43. // });
  44. // product details carousel end
  45. // fileter sidebar function
  46. // filter open button
  47. const filterOpenBtn = document.querySelector("#filter-button");
  48. // filter close button
  49. const filterCloseBtn = document.querySelector('.filter-close-btn');
  50. // filter sidebar container
  51. const filterContainer = document.querySelector('.filter');
  52. // filter open open function
  53. if (filterOpenBtn && filterContainer) {
  54. filterOpenBtn.addEventListener("click", () => {
  55. filterContainer.classList.add("active")
  56. });
  57. }
  58. // filter close button
  59. if (filterContainer && filterCloseBtn) {
  60. filterCloseBtn.addEventListener("click", () => {
  61. filterContainer.classList.remove("active")
  62. });
  63. }
  64. // fileter sidebar function end
  65. // checkout sidebar function
  66. // checkout open desktop button
  67. const checkoutProductBtnDesktop = document.querySelector('.checkout-product-btn-desktop')
  68. // checkout open mobile button
  69. const checkoutProductBtnMobile = document.querySelector('.checkout-product-btn-mobile')
  70. // checkout close button
  71. const checkoutContainerCloseBtn = document.querySelector('.cross-btn')
  72. // checkout container
  73. const checkoutContainer = document.querySelector('.checkout-container')
  74. // checkout open function for desktop
  75. if(checkoutProductBtnDesktop && checkoutContainer && filterContainer) {
  76. checkoutProductBtnDesktop.addEventListener('click', () => {
  77. // hide fillter sidebar if open
  78. filterContainer.classList.remove("active")
  79. // open checkout sidebar
  80. checkoutContainer.style.display = "block";
  81. })
  82. };
  83. // checkout open function for mobile
  84. if(checkoutProductBtnMobile && checkoutContainer && filterContainer) {
  85. checkoutProductBtnMobile.addEventListener('click', () => {
  86. // hide fillter sidebar if open
  87. filterContainer.classList.remove("active");
  88. // open checkout sidebar
  89. checkoutContainer.style.display = "block";
  90. })
  91. };
  92. // checkout close function
  93. if(checkoutContainerCloseBtn && checkoutContainer) {
  94. checkoutContainerCloseBtn.addEventListener('click', () => {
  95. checkoutContainer.style.display = "none"
  96. })
  97. }
  98. // checkout sidebar function end
  99. // all carousel
  100. // homepage hero banner slider home page
  101. const bannerSlider = new Swiper(".bannerSlider", {
  102. spaceBetween: 30,
  103. centeredSlides: true,
  104. autoplay: {
  105. delay: 2500,
  106. disableOnInteraction: false,
  107. }
  108. });
  109. // category slider home page
  110. const categorySlider = new Swiper('.categorySlider', {
  111. loop: false,
  112. slidesPerView: 5,
  113. spaceBetween: 30,
  114. loopedSlides: 1,
  115. breakpoints: {
  116. 0: {
  117. slidesPerView: 3,
  118. },
  119. 576: {
  120. slidesPerView: 4,
  121. },
  122. 993: {
  123. slidesPerView: 5,
  124. }
  125. },
  126. navigation: {
  127. nextEl: ".swiper-button-next",
  128. prevEl: ".swiper-button-prev",
  129. },
  130. });
  131. // Feture brand slider home page
  132. const featuredBrands = new Swiper('.featuredBrands', {
  133. loop: false,
  134. slidesPerView: 4,
  135. spaceBetween: 30,
  136. loopedSlides: 1,
  137. navigation: false,
  138. breakpoints: {
  139. 0: {
  140. slidesPerView: 2,
  141. },
  142. 576: {
  143. slidesPerView: 3,
  144. },
  145. 993: {
  146. slidesPerView: 5,
  147. }
  148. },
  149. });
  150. // Feture brand slider home page
  151. const trendingStories = new Swiper('.trendingStories', {
  152. loop: true,
  153. slidesPerView: 3,
  154. spaceBetween: 30,
  155. loopedSlides: 1,
  156. navigation: false,
  157. breakpoints: {
  158. 0: {
  159. slidesPerView: 1,
  160. },
  161. 576: {
  162. slidesPerView: 2,
  163. },
  164. 993: {
  165. slidesPerView: 3,
  166. }
  167. },
  168. navigation: {
  169. nextEl: ".swiper-button-next",
  170. prevEl: ".swiper-button-prev",
  171. },
  172. });
  173. // all product nav slider brand slider all product page
  174. const allProductNav = new Swiper('.all-product-nav-slider', {
  175. loop: false,
  176. slidesPerView: 8,
  177. spaceBetween: 8,
  178. loopedSlides: 1,
  179. navigation: false
  180. });
  181. // // product details page carousel
  182. // thumb carousel
  183. var productThumb = new Swiper('.productThumb', {
  184. loop: true,
  185. loopedSlides: 1,
  186. spaceBetween: 10,
  187. slidesPerView: 2,
  188. direction: 'vertical',
  189. freeMode: true,
  190. breakpoints: {
  191. 0: {
  192. direction: 'horizontal',
  193. spaceBetween: 15,
  194. slidesPerView: 4,
  195. centeredSlides: true,
  196. },
  197. 993: {
  198. direction: 'vertical',
  199. spaceBetween: 15,
  200. slidesPerView: 3,
  201. }
  202. }
  203. });
  204. // productSlider carousel
  205. var productSlider = new Swiper('.productSlider', {
  206. loop: true,
  207. spaceBetween: 10,
  208. loopedSlides: 1,
  209. centeredSlides: true,
  210. freeMode: true,
  211. navigation: {
  212. nextEl: '.swiper-button-next',
  213. prevEl: '.swiper-button-prev',
  214. disabledClass: 'disabled_swiper_button'
  215. },
  216. thumbs: {
  217. swiper: productThumb,
  218. },
  219. });
  220. // all carousel end
  221. // simple light box
  222. let gallery = new SimpleLightbox('.gallery a', {});
  223. if(gallery) {
  224. gallery.on('show.simplelightbox', function () {
  225. // do something…
  226. });
  227. }