-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
62 lines (55 loc) · 1.56 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
const scroll = new LocomotiveScroll({
el: document.querySelector('#main'),
smooth: true
});
function page4Animation() {
var elemC = document.querySelector("#elem-container")
var fixed = document.querySelector("#fixed-image")
elemC.addEventListener("mouseenter", function () {
fixed.style.display = "block"
})
elemC.addEventListener("mouseleave", function () {
fixed.style.display = "none"
})
var elems = document.querySelectorAll(".elem")
elems.forEach(function (e) {
e.addEventListener("mouseenter", function () {
var image = e.getAttribute("data-image")
fixed.style.backgroundImage = `url(${image})`
})
})
}
function swiperAnimation() {
var swiper = new Swiper(".mySwiper", {
slidesPerView: "auto",
centeredSlides: true,
spaceBetween: 100,
});
}
function menuAnimation() {
var menu = document.querySelector("nav h3")
var full = document.querySelector("#full-scr")
var navimg = document.querySelector("nav img")
var flag = 0
menu.addEventListener("click", function () {
if (flag == 0) {
full.style.top = 0
navimg.style.opacity = 0
flag = 1
} else {
full.style.top = "-100%"
navimg.style.opacity = 1
flag = 0
}
})
}
function loaderAnimation() {
var loader = document.querySelector("#loader")
setTimeout(function () {
loader.style.top = "-100%"
}, 4200)
}
swiperAnimation()
page4Animation()
menuAnimation()
loaderAnimation()