-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
45 lines (39 loc) · 1.18 KB
/
main.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
// === set sticky on navbar ==========================================
// window.onscroll = function() {
// myFunction()
// };
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
// === smooth scroll =================================================
function scrollToId(id) {
console.log(id);
let top = document.getElementById(id).offsetTop;
window.scroll({
top,
behavior: 'smooth'
});
}
// === EXAMPLES ===============================================
function setValues(inNumLines, inLineWeight, inZoom1, inR1, inr1, ind1, inTimeInterval1, inZoom2, inR2, inr2, ind2, inTimeInterval2) {
changeNumLines(inNumLines);
changeLineWeight(inLineWeight);
changeZoom1(inZoom1);
changeR1(inR1);
changer1(inr1);
changed1(ind1);
changeTimefactor1(inTimeInterval1);
changeZoom2(inZoom2);
changeR2(inR2);
changer2(inr2);
changed2(ind2);
changeTimefactor2(inTimeInterval2);
// scroll to the canvas
scrollToId('line-drawings');
}