AOS.init({ once: true })
$(document).ready(function () {
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == "") {
filename = "index.php"
}
$("header .nav-item .nav-link").removeClass("active");
$(`header .nav-item .nav-link[href="${filename}"]`).addClass("active")
});
$('.products-951').owlCarousel({
loop: true,
margin: 20,
nav: true,
dots: false,
autoplay: true,
autoplayTimeout: 3000,
responsive: {
0: {
items: 2
},
600: {
items: 2
},
1000: {
items: 5
}
}
});
$('.new-testimonials').owlCarousel({
loop: true,
margin: 10,
nav: true,
dots: false,
autoplay: true,
autoplayTimeout: 3000,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 3
}
}
})
$('.flash-saling').owlCarousel({
loop: true,
margin: 10,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 3000,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 2.5
}
}
})
$('.banner-slides').owlCarousel({
loop: true,
margin: 100,
nav: false,
dots: true,
center: true,
autoplay: true,
autoplayTimeout: 4000,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 1.4
}
}
})
// product detail page ============
$(document).ready(function () {
var sync1 = $("#sync1");
var sync2 = $("#sync2");
sync1.owlCarousel({
items: 1,
slideSpeed: 2000,
nav: true,
autoplay: false,
dots: false,
loop: true,
responsiveRefreshRate: 200,
navText: ['<svg width="100%" height="100%" viewBox="0 0 11 20"><path style="fill:none;stroke-width: 1px;stroke: #000;" d="M9.554,1.001l-8.607,8.607l8.607,8.606"/></svg>', '<svg width="100%" height="100%" viewBox="0 0 11 20" version="1.1"><path style="fill:none;stroke-width: 1px;stroke: #000;" d="M1.054,18.214l8.606,-8.606l-8.606,-8.607"/></svg>'],
}).on('changed.owl.carousel', syncPosition);
sync2
.on('initialized.owl.carousel', function () {
sync2.find(".owl-item").eq(0).addClass("current");
})
.owlCarousel({
items: 5,
dots: false,
smartSpeed: 200,
slideSpeed: 500,
slideBy: 1,
responsiveRefreshRate: 100
}).on('changed.owl.carousel', syncPosition2);
function syncPosition(el) {
var count = el.item.count - 1;
var current = Math.round(el.item.index - (el.item.count / 2) - .5);
if (current < 0) {
current = count;
}
if (current > count) {
current = 0;
}
sync2
.find(".owl-item")
.removeClass("current")
.eq(current)
.addClass("current");
var onscreen = sync2.find('.owl-item.active').length - 1;
var start = sync2.find('.owl-item.active').first().index();
var end = sync2.find('.owl-item.active').last().index();
if (current > end) {
sync2.data('owl.carousel').to(current, 100, true);
}
if (current < start) {
sync2.data('owl.carousel').to(current - onscreen, 100, true);
}
}
function syncPosition2(el) {
var number = el.item.index;
sync1.data('owl.carousel').to(number, 100, true);
}
sync2.on("click", ".owl-item", function (e) {
e.preventDefault();
var number = $(this).index();
sync1.data('owl.carousel').to(number, 300, true);
});
// FancyBox initialization for the first slider
$(".fancybox").fancybox({
buttons: [
'zoom',
'slideShow',
'fullScreen',
'download',
'thumbs',
'close'
]
});
});
// counting ------------------
document.addEventListener("DOMContentLoaded", function() {
const decButton = document.querySelector('.dec');
const incButton = document.querySelector('.inc');
const quantityInput = document.getElementById('proQuantity');
decButton.addEventListener('click', function() {
let currentValue = parseInt(quantityInput.value);
if (currentValue > 1) {
quantityInput.value = currentValue - 1;
}
});
incButton.addEventListener('click', function() {
let currentValue = parseInt(quantityInput.value);
quantityInput.value = currentValue + 1;
});
});