100 lines
3.3 KiB
JavaScript
100 lines
3.3 KiB
JavaScript
$('#core-sg-swipe').slick({
|
|
prevArrow: '<a class="slick-prev" href=""><i class="icon-angle-left"></i></a>',
|
|
nextArrow: '<a class="slick-next" href=""><i class="icon-angle-right"></i></a>',
|
|
dotsClass: 'hotspot__dots',
|
|
lazyLoad: 'ondemand',
|
|
arrows: true,
|
|
// dots: true,
|
|
dots: false,
|
|
infinite: false,
|
|
slidesToShow: 3,
|
|
slidesToScroll: 1,
|
|
responsive: [{
|
|
breakpoint: 1200,
|
|
settings: {
|
|
slidesToShow: 3,
|
|
slidesToScroll: 1,
|
|
},
|
|
},
|
|
{
|
|
breakpoint: 979,
|
|
settings: {
|
|
slidesToShow: 2,
|
|
slidesToScroll: 2,
|
|
},
|
|
},
|
|
{
|
|
breakpoint: 757,
|
|
settings: {
|
|
slidesToShow: 2,
|
|
slidesToScroll: 1,
|
|
swipeToSlide: true,
|
|
variableWidth: true,
|
|
// centerMode: true,
|
|
// centerPadding: '24vw',
|
|
// dots: false,
|
|
},
|
|
},
|
|
// {
|
|
// breakpoint: 550,
|
|
// settings: {
|
|
// slidesToShow: 1,
|
|
// slidesToScroll: 1,
|
|
// swipeToSlide: true,
|
|
// // centerMode: false,
|
|
// // centerPadding: '18vw',
|
|
// // dots: false,
|
|
// },
|
|
// }
|
|
],
|
|
});
|
|
|
|
app_shop.run(function(){
|
|
if(app_shop.vars.view === 1){
|
|
const tonoClub = document.querySelector("#main_banner1 .main_slider__item").innerHTML
|
|
const lastKafelek = document.querySelector(".menu_contener_kafelki").lastChild;
|
|
lastKafelek.innerHTML = tonoClub
|
|
}
|
|
}, "all", ".menu_contener_kafelki")
|
|
|
|
app_shop.run(function(){
|
|
function getFiveProducts(url, container){
|
|
$.ajax({
|
|
type: "GET",
|
|
url: url,
|
|
success: (data)=>{
|
|
const parser = new DOMParser();
|
|
const allProducts = parser.parseFromString(data, "text/html").querySelectorAll(".product");
|
|
allProducts.forEach((prod, index)=>{
|
|
if(index<5){
|
|
prod.classList.add("products__product");
|
|
prod.classList.remove("col-6");
|
|
const image = prod.querySelector("img");
|
|
image.className = '';
|
|
|
|
image.onload = ()=>{
|
|
setLastLinkHegiht(container, image.offsetHeight)
|
|
}
|
|
|
|
if(image.dataset.src) image.src = image.dataset.src;
|
|
container.insertAdjacentElement("afterbegin", prod)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
const bestsellerContainer = document.querySelector(".products__container--bestseller .products__products");
|
|
const newsContainer = document.querySelector(".products__container--news .products__products");
|
|
getFiveProducts("https://tono.pl/Bestseller-sbestseller-pol.html", bestsellerContainer);
|
|
getFiveProducts("https://tono.pl/Nowosc-snewproducts-pol.html", newsContainer);
|
|
|
|
window.addEventListener("resize", ()=>{
|
|
setLastLinkHegiht(bestsellerContainer, bestsellerContainer.querySelector(".product img").offsetHeight);
|
|
setLastLinkHegiht(newsContainer, newsContainer.querySelector(".product img").offsetHeight);
|
|
})
|
|
|
|
function setLastLinkHegiht(container, height){
|
|
container.querySelector(".--last-link a").style.height = `${height}px`;
|
|
}
|
|
}, "all", ".products__container") |