-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
63 lines (55 loc) · 1.4 KB
/
script.js
File metadata and controls
63 lines (55 loc) · 1.4 KB
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
// LINKS
fetch("links.json")
.then(res => res.json())
.then(data => {
let el = document.getElementById("links");
data.forEach(l => {
el.innerHTML += `
<a href="${l.url}" class="btn">
<div class="btn-left">
<i class="${l.icon}"></i>
${l.title}
</div>
<i class="fas fa-arrow-right"></i>
</a>
`;
});
});
// GALLERY
const gallery = [
{img:"assets/img/1.webp", link:"https://drafterfurniture.com"},
{img:"assets/img/2.webp", link:"https://drafterfurniture.com"},
{img:"assets/img/3.webp", link:"https://drafterfurniture.com"},
{img:"assets/img/4.webp", link:"https://drafterfurniture.com"}
];
let g = document.getElementById("gallery");
gallery.forEach((item, index) => {
g.innerHTML += `
<div class="item">
<img
src="${item.img}"
alt="Desain furniture custom Jepara ${index + 1}"
loading="lazy"
>
<a
href="${item.link}"
target="_blank"
aria-label="Lihat desain furniture ${index + 1}"
title="Lihat desain"
rel="noopener">
<i class="fas fa-arrow-up-right-from-square"></i>
</a>
</div>
`;
});
// SCROLL ANIMATION
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if(entry.isIntersecting){
entry.target.classList.add("show");
}
});
});
document.querySelectorAll(".reveal").forEach(el => {
observer.observe(el);
});