-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
74 lines (69 loc) · 2.24 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Enable tooltips everywhere
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
});
// For main page
if (document.querySelector(".main-page")) {
// Main Carousel
// const mainCarousel = new Carousel(document.querySelector("#main-carousel"), {
// slidesPerPage : 1,
// center : true,
// Dots: false
// });
}
// For product page
if (document.querySelector(".product-page")) {
// Product Carousel
const productCarousel = new Carousel(document.querySelector("#product-carousel"), {
Dots: false,
});
const thumbCarousel = new Carousel(document.querySelector("#product-thumb-carousel"), {
Sync: {
target: productCarousel,
friction: 0,
},
Dots: false,
Navigation: false,
center: true,
slidesPerPage: 1,
infinite: false,
});
// Carousel block
const galleryCarousel = new Carousel(document.querySelector("#gallery-carousel"), {
slidesPerPage : 1,
center : false
});
Fancybox.bind("#gallery-carousel a", {
caption: function (fancybox, carousel, slide) {},
});
// Other blocks
const inColorCarousel = new Carousel(document.querySelector("#in-color-carousel"), {
slidesPerPage : 1,
center : false
});
Fancybox.bind("#in-color-carousel a", {
caption: function (fancybox, carousel, slide) {},
});
}
// Mobile style
window.onscroll = function() {
if (window.pageYOffset == 0) {
document.getElementById("to-top").style.display = "none";
} else {
document.getElementById("to-top").style.display = "block";
}
if ((window.innerHeight + window.scrollY + 900) >= document.body.offsetHeight) {
document.getElementById("mobile-menu").style.setProperty("display", "none", "important");
} else {
document.getElementById("mobile-menu").style.display = "block";
}
}
// Scroll to top
document.getElementById("to-top").onclick = function() { scrollToTop() };
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}