-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
175 lines (151 loc) · 4.5 KB
/
app.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// loading
const loading = document.getElementById("loader-wrapper");
const html = document.querySelector("html");
const animation = document.getElementById("loading-animation");
document.addEventListener("DOMContentLoaded", init);
function init() {
onload = function () {
animation.addEventListener("ended", function () {
loading.classList.toggle("close");
setTimeout(() => {
html.classList.remove("loading");
}, 100);
setTimeout(() => {
loading.remove();
}, 500);
});
};
}
// mobile menu
const menuToggle = document.querySelector(".hamburger-menu input");
const navbar = document.querySelectorAll(".inner-nav ul");
const navlist = document.querySelectorAll(".inner-nav li");
const checkBox = document.querySelector(".checkbox");
menuToggle.addEventListener("click", function () {
for (j = 0; j < navbar.length; j++) {
navbar[j].classList.toggle("open");
}
});
for (i = 0; i < navlist.length; i++) {
navlist[i].addEventListener("click", function () {
for (j = 0; j < navbar.length; j++) {
navbar[j].classList.remove("open");
}
checkBox.checked = false;
});
}
// carousel current use
const carousel = document.querySelectorAll(".swiper-slide");
const swiper = new Swiper(".swiper", {
speed: 1000,
centeredSlides: true,
loop: true,
breakpoints: {
// when window width is >= 576px
100: {
slidesPerView: 1,
spaceBetween: 10,
},
835: {
slidesPerView: 2,
spaceBetween: 50,
},
},
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
// Navigation arrows
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
// And if we need scrollbar
scrollbar: {
el: ".swiper-scrollbar",
},
});
const swiper2 = new Swiper(".swiper-2", {
speed: 1000,
centeredSlides: true,
loop: true,
effect: "fade",
fadeEffect: {
crossFade: true,
},
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
// Navigation arrows
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
// And if we need scrollbar
scrollbar: {
el: ".swiper-scrollbar",
},
});
// maps
var locations = [
[
"<h1>Ebiko Sushi Dan Takoyaki <br> Lebak Bulus (Cabang Pertama)</h1> <p>Ebiko Sushi dan Takoyaki, Jl. Damar No.9, RW.6, Pd. Labu, Kec. Cilandak, Kota Jakarta Selatan, Daerah Khusus Ibukota Jakarta 12450</p> <a href='https://g.page/ebiko-sushi-dan-takoyaki?share'>Lihat di Maps</a>",
-6.31211697687172,
106.78624361808949,
],
[
"<h1>Ebiko Sushi Dan Takoyaki <br> Pondok Aren</h1><p>Ebiko Sushi dan Takoyaki Pondok Aren, Jl. Ceger Raya Gang Ambin No.71, RT.1/RW.11, Jurang Mangu Barat, Kec. Pd. Aren, Kota Tangerang Selatan, Banten 15223</p> <a href='https://goo.gl/maps/59wRaMc5pNvQzZi1A'>Lihat di Maps</a>",
-6.262666148652281,
106.72834485281574,
],
[
"<h1>Ebiko Sushi Dan Takoyaki <br> Pamulang</h1><p>Ebiko Sushi dan Takoyaki Pamulang, Jl. Cemara II No.86, Pamulang Bar., Kec. Pamulang, Kota Tangerang Selatan, Banten 15417</p> <a href='https://goo.gl/maps/D6xJ4PF2KUpFn3fm8'>Lihat di Maps</a>",
-6.337620933208679,
106.73968062650742,
],
];
var pc = true;
if (
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
pc = false;
}
var map = L.map("map", {
gestureHandling: true,
attributionControl: false,
dragging: pc,
tap: pc,
}).setView([-6.299548, 106.751261], 11);
var googleStreets = L.tileLayer(
"http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
{
maxZoom: 20,
subdomains: ["mt0", "mt1", "mt2", "mt3"],
}
);
var markerIcon = L.icon({
iconUrl: "./assets/logo/marker.webp",
iconSize: [50, 80], // size of the icon
iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
popupAnchor: [6, -76], // point from which the popup should open relative to the iconAnchor
});
googleStreets.addTo(map);
for (var i = 0; i < locations.length; i++) {
marker = L.marker([locations[i][1], locations[i][2]], { icon: markerIcon })
.bindPopup(locations[i][0])
.addTo(map);
}
const mapEl = document.querySelector("#map");
// Binds event listeners for the map and calls the function
mapEl.addEventListener("touchstart", onTwoFingerDrag);
mapEl.addEventListener("touchend", onTwoFingerDrag);
function onTwoFingerDrag(e) {
if (e.type === "touchstart" && e.touches.length === 1) {
e.currentTarget.classList.add("swiping");
} else {
e.currentTarget.classList.remove("swiping");
}
}