script-impact.js
7.52 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
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
jQuery(document).ready(function($) {
var term03 = $(".wheel-03 .term03");
var term04 = $(".wheel-03 .term04");
var term05 = $(".wheel-03 .term05");
var term06 = $(".wheel-03 .term06");
var term07 = $(".wheel-03 .term07");
var stepFrame = 5;
tl03 = new TimelineLite();
tl03
.to(term03, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css: { className: "term term00" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
tl04 = new TimelineLite();
tl04
.to(term04, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term00" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
tl05 = new TimelineLite();
tl05
.to(term05, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
;
tl06 = new TimelineLite();
tl06
.to(term06, stepFrame, {
css: { className: "term term05" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
;
tl07 = new TimelineLite();
tl07
.to(term07, stepFrame, {
css: { className: "term term06" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term05" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
wheel03 = new TimelineMax({ repeat: 100, timeScale: 10, yoyo:true });
wheel03.add(tl03, 0);
wheel03.add(tl04, 0);
wheel03.add(tl05, 0);
wheel03.add(tl06, 0);
wheel03.add(tl07, 0);
wheel03.pause();
setInterval(myTimer, 1000);
function myTimer() {
//
if(!$('.full-screen').hasClass('paused')){
wheel03.play();
//
//$('canvas').remove();
setTimeout(() => {
wheel03.pause();
}, 500);
}
}
TweenMax.to(wheel03, 0.1, { timeScale: 10, ease: Circ.easeOut });
$(document).on('click', '.video-thumb', function(){
$('.full-screen').hide();
var video = document.getElementsByTagName('video')[0];
var sources = video.getElementsByTagName('source');
var track = video.getElementsByTagName('track');
sources[0].src = $(this).data('video');
track[0].src = $(this).data('cc');
video.load();
video.muted = false;
video.removeAttribute("loop");
$('.play').hide();
$('.pause').hide();
$('.product-header-image').css('background-image','none').css('background-color','#000');
$('#myVideo').css('position','relative').css('right','unset').css('min-width','unset').css('max-width','100vw').css('max-height','99.8%');;
video.setAttribute("controls","controls")
// if (video.requestFullscreen) {
// video.requestFullscreen();
// } else if (video.msRequestFullscreen) {
// video.msRequestFullscreen();
// } else if (video.mozRequestFullScreen) {
// video.mozRequestFullScreen();
// } else if (video.webkitRequestFullscreen) {
// video.webkitRequestFullscreen();
// }
});
$(document).on('click', '.pause', function(){
$('.full-screen').addClass('paused');
$(this).hide();
$('.play').show();
var video = document.getElementsByTagName('video')[0];
video.pause();
wheel03.pause();
});
$(document).on('click', '.play', function(){
$('.full-screen').removeClass('paused');
$(this).hide();
$('.pause').show();
var video = document.getElementsByTagName('video')[0];
video.play();
wheel03.play();
});
$('.video-thumb-title').sameHeight();
$(window).resize(function(){
$('.video-thumb-title').css('height','unset');
$('.video-thumb-title').sameHeight();
});
});
(function(document, history, location) {
var HISTORY_SUPPORT = !!(history && history.pushState);
var anchorScrolls = {
ANCHOR_REGEX: /^#[^ ]+$/,
OFFSET_HEIGHT_PX: 150,
/**
* Establish events, and fix initial scroll position if a hash is provided.
*/
init: function() {
this.scrollToCurrent();
window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
document.body.addEventListener('click', this.delegateAnchors.bind(this));
},
/**
* Return the offset amount to deduct from the normal scroll position.
* Modify as appropriate to allow for dynamic calculations
*/
getFixedOffset: function() {
return this.OFFSET_HEIGHT_PX;
},
/**
* If the provided href is an anchor which resolves to an element on the
* page, scroll to it.
* @param {String} href
* @return {Boolean} - Was the href an anchor.
*/
scrollIfAnchor: function(href, pushToHistory) {
var match, rect, anchorOffset;
if(!this.ANCHOR_REGEX.test(href)) {
return false;
}
match = document.getElementById(href.slice(1));
if(match) {
rect = match.getBoundingClientRect();
anchorOffset = window.pageYOffset + rect.top - this.getFixedOffset();
window.scrollTo(window.pageXOffset, anchorOffset);
// Add the state to history as-per normal anchor links
if(HISTORY_SUPPORT && pushToHistory) {
history.pushState({}, document.title, location.pathname + href);
}
}
return !!match;
},
/**
* Attempt to scroll to the current location's hash.
*/
scrollToCurrent: function() {
this.scrollIfAnchor(window.location.hash);
},
/**
* If the click event's target was an anchor, fix the scroll position.
*/
delegateAnchors: function(e) {
var elem = e.target;
if(
elem.nodeName === 'A' &&
this.scrollIfAnchor(elem.getAttribute('href'), true)
) {
e.preventDefault();
}
}
};
window.addEventListener(
'DOMContentLoaded', anchorScrolls.init.bind(anchorScrolls)
);
})(window.document, window.history, window.location);
(function( $ ) {
// the sameHeight functions makes all the selected elements of the same height
$.fn.sameHeight = function() {
var selector = this;
var heights = [];
// Save the heights of every element into an array
selector.each(function(){
var height = $(this).height();
heights.push(height);
});
// Get the biggest height
var maxHeight = Math.max.apply(null, heights);
// Show in the console to verify
console.log(heights,maxHeight);
// Set the maxHeight to every selected element
selector.each(function(){
$(this).height(maxHeight);
});
};
}( jQuery ));