-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
191 lines (155 loc) · 5.07 KB
/
script.js
File metadata and controls
191 lines (155 loc) · 5.07 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
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
$(document).ready(function () {
gsap.registerPlugin(ScrollTrigger);
gsap.to(".coinOne", {
scrollTrigger: {
trigger: ".home",
scrub: true
},
rotation: 240,
duration: 1
})
gsap.to(".coinTwo", {
scrollTrigger: {
trigger: ".home",
scrub: true
},
rotation: 120,
duration: 1
})
ScrollTrigger.matchMedia({
// desktop
"(min-width: 480px)": function () {
gsap.set(".panel", {
zIndex: (i, target, targets) => targets.length - i
});
var images = gsap.utils.toArray('.panel:not(.orange)');
images.forEach((image, i) => {
var tl = gsap.timeline({
scrollTrigger: {
trigger: "section.black",
scroller: false,
start: () => "top -" + (window.innerHeight * (i + 0.5)),
end: () => "+=" + window.innerHeight,
scrub: true,
toggleActions: "play none reverse none",
invalidateOnRefresh: true,
}
})
tl
.to(image, {
// height: 0
duration: 2,
opacity: 1,
y: "100%"
});
});
gsap.set(".panel-text", {
zIndex: (i, target, targets) => targets.length - i
});
var texts = gsap.utils.toArray('.panel-text');
texts.forEach((text, i) => {
var tl = gsap.timeline({
scrollTrigger: {
trigger: "section.black",
scroller: false,
start: () => "top -" + (window.innerHeight * i),
end: () => "+=" + window.innerHeight,
scrub: true,
toggleActions: "play none reverse none",
invalidateOnRefresh: true,
}
})
tl
.to(text, {
duration: 1,
zIndex: 100,
opacity: 1,
y: "10%"
})
.to(text, {
duration: 1,
opacity: 0,
y: "0%"
}, 2);
});
ScrollTrigger.create({
trigger: ".scroller__wrapper",
scroller: false,
scrub: true,
markers: false,
pin: true,
start: "top top",
// end: "+=1850",
end: () => "+=" + ((images.length + 1) * window.innerHeight),
invalidateOnRefresh: true,
anticipatePin: 1
});
},
})
$(document).on('click', '.navbar-nav li a', function (e) {
var targetHref = $(this).attr('href');
$(".navbar-collapse").collapse('hide');
$('html, body').animate({
scrollTop: $(targetHref).offset().top - 100
}, 1000);
e.preventDefault();
})
window.onload = function(){
document.querySelector('.toggler').onclick = () => {
document.querySelector('.nav').classList.toggle('open');
}
}
var $owl = $('#carousel1');
$owl.children().each(function (index){
$(this).attr('data-position', index);
});
$('#carousel1').owlCarousel({
loop:false,
autoplay:true,
autoplayTimeout:3000,
autoplayHoverPause:true,
rewind: true,
center: true,
margin:0,
responsiveClass: true,
nav:false,
responsive: {
0: {
items: 1
},
680: {
items: 2
},
1000: {
items: 3
},
}
})
$(document).on('click', '.owl-item>div', function(){
var $speed = 1000;
$owl.trigger('to.owl.carousel', [$(this).data('position'), $speed])
})
var modal = document.getElementById("myModal");
var modalOverlay = document.getElementsByClassName("Modal__modal-overlay-div___RqVH9")[0]
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("Modal__btn-close___ZrwW_")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
modalOverlay.style.display="block"
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
modalOverlay.style.display="none"
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
modalOverlay.style.display="none";
}
}
})