forked from kellynauert/rovercode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (41 loc) · 1.71 KB
/
index.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
//Set the sponsorship and contributions divs to be the same height. justify-content-between then spreads out the elements and aligns them.
function sectionHeight() {
let contributeHeight = document.getElementById('contribute').clientHeight;
let sponsorHeight = document.getElementById('sponsorImage').clientHeight;
if (sponsorHeight > contributeHeight) {
document.getElementById('sponsor').setAttribute('style', 'height:' + contributeHeight + 'px ;');
} else {
document.getElementById('contribute').setAttribute('style', 'height:' + sponsorHeight + 'px ;');
}
}
function hero() {
let heroHeight = document.getElementById('hero').clientHeight;
document.querySelectorAll('.layer').forEach(item => {
item.setAttribute('style', 'height:' + heroHeight + 'px ;');
});
}
//Parallax fun
(function () {
window.addEventListener('scroll', function (event) {
var depth, layer, layers, movement, topDistance, translate3d, _i, _len;
topDistance = this.pageYOffset;
layers = document.querySelectorAll("[data-type='parallax']");
for (_i = 0, _len = layers.length; _i < _len; _i++) {
layer = layers[_i];
depth = layer.getAttribute('data-depth');
movement = -(topDistance * depth);
translate3d = 'translate3d(0, ' + movement + 'px, 0)';
layer.style['-webkit-transform'] = translate3d;
layer.style['-moz-transform'] = translate3d;
layer.style['-ms-transform'] = translate3d;
layer.style['-o-transform'] = translate3d;
layer.style.transform = translate3d;
}
});
}.call(this));
//navbar spacer
let navHeight = document.getElementById('nav').clientHeight;
function spacerHeight() {
let spacerHeight = document.getElementById('navbar-spacer');
spacerHeight.setAttribute('style', 'height:' + navHeight + 'px ;');
}