//SWIPER SLIDER SHOWCASE function swiperShowCase() { new Swiper(".swiper-showcase", { slidesPerView: 1, spaceBetween: 10, centeredSlides: true, loop: true, speed: 1000, preloadImages: false, lazy: true, autoplay: { delay: 2500, disableOnInteraction: false, pauseOnMouseEnter: "true", }, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, }); } swiperShowCase(); //COLLECTION function swiperCollectionBox() { new Swiper(".homepage-collection-swiper", { slidesPerView: 2.5, spaceBetween: 6, rewind: true, speed: 1000, preloadImages: false, lazy: true, }); } swiperCollectionBox(); // SET CATEGOTY ITEM LINK TO VIEW MORE BUTTON function setLinkToSeeAllBtn(target, categoryLink) { target .parents(".collection-tab-container") .find(".all-item-collection") .children() .attr("href", categoryLink); } // COLLECTION SECTION function collectionBoxHandler() { $(".js-collection-item").on("click", function () { var collectionId = $(this).attr("data-id"); var collectionLink = $(this).attr("data-url"); $(this).parent().find(".active").removeClass("active"); $(this).addClass("active"); getCollectionProduct(collectionId); setLinkToSeeAllBtn($(this), collectionLink); }); } function getCollectionProduct(collectionId) { var params = { action_type: "list", id: collectionId, show: 18, }; var target = "#js-collection-holder"; Hura.Ajax.get("collection", params).then(function (data) { var html = Hura.Template.parse(productTpl, data.list); Hura.Template.render(target, html); }); } function firstClickCollection() { collectionBoxHandler(); $(".js-collection-item").first().click(); } firstClickCollection(); //SWIPER CATEGORY HOMEPAGE function swiperListBox() { new Swiper(".homepage-cat-swiper", { slidesPerView: 2, spaceBetween: 10, rewind: true, speed: 1000, preloadImages: false, lazy: true, }); } swiperListBox(); function lazyCategoryBox(){ for (let i = 0; i <= category_to_fetch.length - 1; i++) { let idCat = category_to_fetch[i] lazy_load_group.push({ id: "js-product-" + idCat, target: "#js-product-" + idCat, loadFn: function () { getCategoryProduct(idCat) }, }); } } lazyCategoryBox(); // AJAX CATEGORY BOX - HOT PRODUCT function getCategoryProduct(id) { var params = { action_type: "product-list", category: id, }; var target = "#js-product-" + id; Hura.Ajax.get("product", params).then(function (data) { //console.log(data.list); if (data.total == 0) { $(target).html( `