-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsome js.txt
More file actions
92 lines (72 loc) · 2.53 KB
/
Copy pathsome js.txt
File metadata and controls
92 lines (72 loc) · 2.53 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
some js
// function movement(){
// let id =null;
// const elem = document.getElementsByClassName("box62");
// let myposition =0;
// clearInterval(id);
// id =setInterval(frame, 5);
// function frame(){
// if(myposition == 350){
// clearInterval(id);
// }
// else{
// myposition++;
// elem.style.top = myposition + "px";
// }
// }
// }
// function movement() {
// for (let i = 0; i < 7; i++)
// {
// let elem = document.getElementsByClassName("total")[i]; // Select the first element with class "box62"
// let myposition = 0;
// let id = setInterval(frame, 10);
// function frame() {
// if (myposition >= 200) {
// clearInterval(id);
// } else {
// myposition++;
// elem.style.top = -myposition + "px"; // Move the element upwards (negative value)
// }
// }
// }
// }
// function movement() {
// let elem = document.querySelector("#total"); // Select the first element with class "total"
// let myposition = 0;
// let id = setInterval(frame, 10);
// function frame() {
// if (myposition >= 200) {
// clearInterval(id);
// } else {
// myposition++;
// elem.style.top = -myposition + "px"; // Move the element upwards (negative value)
// }
// }
// }
// let list = document.querySelectorAll("ul li");
// let div = document.querySelector(".seconddiv");
// if (window.localStorage.getItem("color")) {
// // 1) add color to div
// div.style.backgroundColor = window.localStorage.getItem("color");
// // 2)remove active class from all li
// list.forEach((li) => {
// li.classList.remove("active");
// });
// // 3)add active class to current color
// document.querySelector(`[data-color="${window.localStorage.getItem("color")}"]`).classList.add("active");
// }
// list.forEach((li) => {
// li.addEventListener("click", (e) => {
// //remove active class from all li
// list.forEach((li) => {
// li.classList.remove("active");
// });
// //add active class to current element
// e.currentTarget.classList.add("active");
// //add current color to local storage
// window.localStorage.setItem("color", e.currentTarget.dataset.color);
// // change div background color
// div.style.backgroundColor = e.currentTarget.dataset.color;
// });
// });