-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhinh-anh.html
387 lines (348 loc) · 18.7 KB
/
hinh-anh.html
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="utf-8">
<title>Foobar Coffee</title>
<meta name="description" content="Cà phê Foobar">
<meta name="author" content="Thin">
<link rel="shortcut icon" href="data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA=" />
<link rel="icon" type="image/png" href="/images/icons8-coffee-64.png">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/hinh-anh.css">
</head>
<body>
<header>
<div class="top-bar">
<div class="logo">
<a href="index.html"><img alt="Hình logo" src="images/logo.png" width="306" height="53" /></a>
</div>
<nav>
<ul id="menu-items">
<li><a href="index.html">Trang chủ</a></li>
<li><a href="gioi-thieu.html">Giới thiệu</a></li>
<li><a href="hinh-anh.html">Hình ảnh</a></li>
<li><a href="dich-vu.html">Dịch vụ</a></li>
<li><a href="lien-he.html">Liên hệ</a></li>
<li><a id="search-icon" href="#."><img alt="Search icon" src="images/search-icon.png" width="20" height="20" /></a></li>
</ul>
</nav>
</div>
</header>
<main>
<section class="gallery gallery-current">
<div class="gallery-intro">
<h1 class="heading-center">Thư viện ảnh</h1>
<p>Hình ảnh những cốc cà phê được bàn tay của những người pha chế tài hoa của chúng tôi thực hiện.</p>
</div>
<div class="gallery-rows">
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-1.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê espresso" src="images/304x171-1.jpg" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-2.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê Cappuchino" src="images/304x171-2.jpg" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-3.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê bốc khói" src="images/304x171-3.jpg" width="304" height="171" /></a></div>
</div>
<div class="gallery-rows">
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-4.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê hạt" src="images/304x171-4.jpg" loading="lazy" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-5.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê latte" src="images/304x171-5.jpg" loading="lazy" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-6.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê ngũ cốc" src="images/304x171-6.jpg" loading="lazy" width="304" height="171" /></a></div>
</div>
<div class="gallery-rows">
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-7.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê vẽ hình" src="images/304x171-6.jpg" loading="lazy" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-8.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê đen" src="images/304x171-8.jpg" loading="lazy" width="304" height="171" /></a></div>
<div class="gallery__item"><a class="gallery__itemLink" href="images/1280x720-9.jpg" data-rel="aiLightbox"><img class="gallery__itemThumb" alt="Cà phê cạn" src="images/304x171-9.jpg" loading="lazy" width="304" height="171" /></a></div>
</div>
<div class="center">
<button class="read-more"><a href="#">Xem thêm</a></button>
</div>
</section>
</main>
<footer>
<div class="footer-row">
<div class="footer-col footer-col1">
<h1>Giới thiệu</h1>
<p>Foobar Coffee là một quán cà phê toạ lạc trên ngọn đồi giáp biển, nhìn ra vịnh Nha Trang. Quán được xây dựng bằng vật liệu thân thiện môi trường.</p>
</div>
<div class="footer-col footer-col2">
<h1>Khám phá</h1>
<nav>
<ul>
<li><a href="index.html">Trang chủ</a></li>
<li><a href="intro.html">Giới thiệu</a></li>
<li><a href="hinh-anh.html">Hình ảnh</a></li>
<li><a href="dich-vu.html">Dịch vụ</a></li>
<li><a href="lien-he.html">Liên hệ</a></li>
</ul>
</nav>
</div>
<div class="footer-col footer-col3">
<h1>Tham khảo thêm</h1>
<nav>
<ul>
<li><a href="#">Lịch sử cà phê</a></li>
<li><a href="#">Cà phê Việt Nam</a></li>
<li><a href="#">Các kiểu pha chế</a></li>
<li><a href="#">Cà phê và sức khoẻ</a></li>
</ul>
</nav>
</div>
<div class="footer-col footer-col4">
<h1>Liên hệ</h1>
<p><i class="fas fa-map-marker-alt"></i> Núi Cô Tiên - Nha Trang</p>
<p><i class="fas fa-phone-volume"></i> 0903.999.999</p>
<p><i class="far fa-envelope"></i> [email protected]</p>
</div>
</div><!-- footer cols -->
<div class="footer-copyright">
<p>© 2020. Foobar Coffee giữ bản quyền nội dung.</p>
</div>
</footer>
<script src="js/script.js"></script>
<script src="js/swipe.js"></script>
<script>
window.onload = function () {
activeLink();
initModal();
searchObj.addEventListener("click", searchModal);
}
</script>
<script>
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _class, _temp, _initialiseProps;
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) {if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; }
return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Lightbox = (_temp = _class = function Lightbox(_ref) {
var _ref$lazyload = _ref.lazyload;
var lazyload = _ref$lazyload === undefined ? true : _ref$lazyload;
var _ref$counter = _ref.counter;
var counter = _ref$counter === undefined ? true : _ref$counter;
var _ref$arrows = _ref.arrows;
var arrows = _ref$arrows === undefined ? true : _ref$arrows;
var _ref$slideSpeed = _ref.slideSpeed;
var slideSpeed = _ref$slideSpeed === undefined ? 400 : _ref$slideSpeed;
var options = _objectWithoutProperties(_ref, ['lazyload', 'counter', 'arrows', 'slideSpeed']);
_classCallCheck(this, Lightbox);
_initialiseProps.call(this);
if (!options.selector) {
console.error('Please add a valid css selector with the option "selector:"');
} else if (typeof options.selector !== 'string') {
console.error(options.selector, 'is not a string but a(n) ' + _typeof(options.selector));
} else {
this.selector = options.selector;
this.lazyload = lazyload;
this.counter = counter;
this.arrows = arrows;
this.slideSpeed = slideSpeed;
this.links = Array.from(document.querySelectorAll('a' + options.selector));
this.offsets = [];
this.nodes = {};
this.imageIndex = null;
if (this.links.length > 0) {
this.createLightbox();
this.createNodes();
this.eventListeners(this.links);
} else {
console.error('The selector \'' + this.selector + '\' did not yield results. Please make sure the selector is applied on an \'a\' element.');
}
}
}, _initialiseProps = function _initialiseProps() {
var _this = this;
this.goTo = function (num, event) {
var _nodes = _this.nodes;
var items = _nodes.items;
var counter = _nodes.counter;
var lightboxNode = _nodes.lightboxNode;
if (_this.counter) {
counter.innerHTML = num + 1 + '/' + _this.links.length;
}
var spinner = '<div class="spinner"></div>';
var img = items[num].querySelector('img');
if (_this.lazyload) {
var src = img.getAttribute('data-src');
items[num].insertAdjacentHTML('beforeend', spinner);
// Set image attribute
img.setAttribute('src', src);
// Add class to slide item when image is completely loaded. Must be in this order.
var imgLoad = new Image();
imgLoad.onload = function () {
items[num].classList.add('is-active');
items[num].classList.add('is-loaded');
};
imgLoad.src = src;
} else {
items[num].classList.add('is-active');
items[num].classList.add('is-loaded');
}
// Change the offset for each slide based on its index and the current index.
for (var i = 0; i < _this.offsets.length; i++) {
var offset = _this.offsets[i] - num * 100;
items[i].style.transform = 'translateX(' + offset + 'vw)';
// Add transition type based on which event was triggered
if (event) {
if (event.target.className === 'gallery__itemThumb') {
items[i].style.transition = 'opacity 0.4s ease';
} else {
items[i].style.transition = 'transform ' + _this.slideSpeed + 'ms ease-out';
}
}
}
};
this.createNodes = function (links) {
// Find all the lightbox nodes and add them to an object
Object.assign(_this.nodes, {
lightboxNode: document.querySelector('.m-lightbox'),
items: Array.from(document.querySelectorAll('.m-lightbox__slide')),
next: document.querySelector('.m-lightbox__nextPrev--next'),
prev: document.querySelector('.m-lightbox__nextPrev--prev'),
close: document.querySelector('.m-lightbox__close')
});
Object.assign(_this.nodes, {
counter: document.querySelector('.m-lightbox__counter')
});
};
this.eventListeners = function (links) {
var _nodes2 = _this.nodes;
var lightboxNode = _nodes2.lightboxNode;
var items = _nodes2.items;
var next = _nodes2.next;
var prev = _nodes2.prev;
var close = _nodes2.close;
links.forEach(function (item, index) {
item.addEventListener('click', function (e) {
e.preventDefault();
lightboxNode.classList.add('is-active');
document.body.style.overflow = 'hidden';
_this.imageIndex = index;
_this.goTo(index, e);
_this.setNav(index);
});
});
next.addEventListener('click', function (e) {
_this.goToNext(e);
});
prev.addEventListener('click', function (e) {
_this.goToPrev(e);
});
close.addEventListener('click', function () {
_this.closeBox();
});
document.onkeydown = function (e) {
switch (e.keyCode) {
case 37:
_this.goToPrev(e);
break;
case 39:
_this.goToNext(e);
break;
case 27:
_this.closeBox();
break;
};
};
items.forEach(function (item) {
new Swipe(item.querySelector('img'), function (e, direction) {
e.preventDefault();
switch (direction) {
case "up":
// Handle Swipe Up
break;
case "down":
// Handle Swipe Down
break;
case "left":
_this.goToNext(e);
break;
case "right":
_this.goToPrev(e);
break;
}
});
});
};
this.setNav = function (index) {
if (_this.arrows) {
var _nodes3 = _this.nodes;
var next = _nodes3.next;
var prev = _nodes3.prev;
if (index < _this.links.length - 1) {
next.classList.add('is-active');
}
if (index >= _this.links.length - 1) {
next.classList.remove('is-active');
}
if (index > 0) {
prev.classList.add('is-active');
}
if (index <= 0) {
prev.classList.remove('is-active');
}
}
};
this.goToNext = function (e) {
var items = _this.nodes.items;
if (_this.imageIndex < items.length - 1) {
_this.goTo(_this.imageIndex + 1, e);
setTimeout(function () {
items[_this.imageIndex - 1].classList.remove('is-active');
}, _this.slideSpeed);
_this.imageIndex += 1;
_this.setNav(_this.imageIndex);
}
};
this.goToPrev = function (e) {
var items = _this.nodes.items;
if (_this.imageIndex > 0) {
_this.goTo(_this.imageIndex - 1, e);
setTimeout(function () {
items[_this.imageIndex + 1].classList.remove('is-active');
}, _this.slideSpeed);
_this.imageIndex -= 1;
_this.setNav(_this.imageIndex);
}
};
this.closeBox = function () {
var _nodes4 = _this.nodes;
var lightboxNode = _nodes4.lightboxNode;
var items = _nodes4.items;
lightboxNode.classList.remove('is-active');
document.body.style.overflow = 'auto';
setTimeout(function () {
items.forEach(function (item) {
return item.classList.remove('is-active');
});
}, _this.slideSpeed);
};
this.renderImages = function (images) {
var imagesLinks = images.map(function (item, index) {
var offset = index * 100;
_this.offsets.push(offset);
var imageSrc = item.getAttribute('href');
return '\n <li class=\'m-lightbox__slide\' style=\'transform: translateX(' + offset + 'vw)\'>\n ' + (_this.lazyload ? '\n <img data-src=\'' + imageSrc + '\'/>\n ' : '\n <img src=\'' + imageSrc + '\'/>\n ') + '\n </li>\n ';
});
return imagesLinks;
};
this.createLightbox = function () {
var lightbox = '<div class="m-lightbox">';
lightbox += '<div class="m-lightbox__controls">';
lightbox += '<button class="m-lightbox__close">';
lightbox += '<img src="images/close.svg" width="24" height="24" /></button>';
lightbox += '<button class="m-lightbox__nextPrev m-lightbox__nextPrev--prev">';
lightbox += '<img src="images/prev.svg" width="24" height="24" /></button>';
lightbox += '<button class="m-lightbox__nextPrev m-lightbox__nextPrev--next">';
lightbox += '<img src="images/next.svg" width="24" height="24" /></button>';
lightbox += '</div>';
lightbox += '<ul class="m-lightBox__slider">' + _this.renderImages(_this.links).join('') + '</ul>';
lightbox += '<div class="m-lightbox__counter"></div>';
lightbox += '</div>';
document.body.insertAdjacentHTML('beforeend', lightbox);
};
}, _temp);
var lb = new Lightbox({
selector: '[data-rel="aiLightbox"]', // string
lazyload: true, // boolean
arrows: true, // boolean
counter: true, // boolean
slideSpeed: 500 });
</script>
</body>
</html>