-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfall21.js
62 lines (44 loc) · 1.28 KB
/
fall21.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
function scale (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
var colours = [
// "red",
// "cornflowerblue",
// "darkorchid",
// "blue",
// "orange"
"#777744",
"#aa6622",
"#ee0011",
"#aa6600",
"#008855",
"#dd1188",
"#8866aa",
"#4466ff"
];
function getColour() {
return colours[
Math.floor(Math.random() * colours.length)
];
}
document.documentElement.style.setProperty('--primary-color', getColour());
$(window).scroll(function(){
var scrollTop = $(window).scrollTop();
var pageHeight = $(document).height();
var scaleScoll = scale (scrollTop, 0, pageHeight, 1, 5);
var scaleOpacity = scale (scrollTop, 0, pageHeight, .9, .3);
maxHeight = 150 - 75 * (((scrollTop-200) * 100)/200)/100;
$('.portal').css({transform: 'scale('+scaleScoll+')'});
$('.portal').css({opacity: scaleOpacity});
});
function sectionJump(value){
var top = document.getElementById(value).offsetTop - 100;
window.scrollTo(0, top);
//document.getElementById(value).scrollIntoView();
}
$(document).ready(function(){
$("#changecolour").on('click', function(){
document.documentElement.style.setProperty('--primary-color', getColour());
});
$('#class').fadeIn();
});