-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
117 lines (98 loc) · 3.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
(function($) {
"use strict";
var searchPopup = function() {
// open search box
$('#header-nav').on('click', '.search-button', function(e) {
$('.search-popup').toggleClass('is-visible');
});
$('#header-nav').on('click', '.btn-close-search', function(e) {
$('.search-popup').toggleClass('is-visible');
});
$(".search-popup-trigger").on("click", function(b) {
b.preventDefault();
$(".search-popup").addClass("is-visible"),
setTimeout(function() {
$(".search-popup").find("#search-popup").focus()
}, 350)
}),
$(".search-popup").on("click", function(b) {
($(b.target).is(".search-popup-close") || $(b.target).is(".search-popup-close svg") || $(b.target).is(".search-popup-close path") || $(b.target).is(".search-popup")) && (b.preventDefault(),
$(this).removeClass("is-visible"))
}),
$(document).keyup(function(b) {
"27" === b.which && $(".search-popup").removeClass("is-visible")
})
}
var initProductQty = function(){
$('.product-qty').each(function(){
var $el_product = $(this);
var quantity = 0;
$el_product.find('.quantity-right-plus').click(function(e){
e.preventDefault();
var quantity = parseInt($el_product.find('#quantity').val());
$el_product.find('#quantity').val(quantity + 1);
});
$el_product.find('.quantity-left-minus').click(function(e){
e.preventDefault();
var quantity = parseInt($el_product.find('#quantity').val());
if(quantity>0){
$el_product.find('#quantity').val(quantity - 1);
}
});
});
}
$(document).ready(function() {
searchPopup();
initProductQty();
var swiper = new Swiper(".main-swiper", {
speed: 500,
navigation: {
nextEl: ".swiper-arrow-prev",
prevEl: ".swiper-arrow-next",
},
});
var swiper = new Swiper(".product-swiper", {
slidesPerView: 4,
spaceBetween: 10,
pagination: {
el: "#mobile-products .swiper-pagination",
clickable: true,
},
breakpoints: {
0: {
slidesPerView: 2,
spaceBetween: 20,
},
980: {
slidesPerView: 4,
spaceBetween: 20,
}
},
});
var swiper = new Swiper(".product-watch-swiper", {
slidesPerView: 4,
spaceBetween: 10,
pagination: {
el: "#smart-watches .swiper-pagination",
clickable: true,
},
breakpoints: {
0: {
slidesPerView: 2,
spaceBetween: 20,
},
980: {
slidesPerView: 4,
spaceBetween: 20,
}
},
});
var swiper = new Swiper(".testimonial-swiper", {
loop: true,
navigation: {
nextEl: ".swiper-arrow-prev",
prevEl: ".swiper-arrow-next",
},
});
}); // End of a document ready
})(jQuery);