-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefer-script.js
71 lines (49 loc) · 1.55 KB
/
defer-script.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
63
64
65
66
67
68
69
70
71
var firstName = prompt("What is your First name?");
if(firstName == "" || firstName == null)
{
alert("You did not enter your First name..");
}
else {
alert("Good day! " + firstName + ", welcome to Henritek");
}
var state = false;
function toggle() {
var body = document.getElementById('body');
//let div = document.getElementsByClassName('box');
var mode = document.getElementById('btn1');
if (state) {
body.style.background="rgba(128,128,128,0.1)";
//div.style.background="rgba(192,192,192,0.3)";
mode.innerText="Dark";
mode.style.background="black";
mode.style.color="white";
mode.style.border="3px inset silver";
state = false ;
}
else{
body.style.background="rgba(0,0,0,0.84)";
//div.style.background="rgba(173, 216, 230, 0.3)";
mode.innerText="Light" ;
mode.style.background="white";
mode.style.color="black";
mode.style.border="3px outset silver";
state = true ;
}
}
const toTop =
document.querySelector(".btnScrollToTop");
window.addEventListener("scroll", () => {
if (window.pageYOffset > 100)
{ toTop.classList.add("active"); }
else
{ toTop.classList.remove("active");
}})
btnScrollToTop.addEventListener("click", function() {
//window.scrollTo(0, 0);
/*window.scrollTo({
top: 0,
left: 0,
behavior: "smooth"
});*/
$("html, body").animate({scrollTop: 0 }, "slow");
});