-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathscript.js
131 lines (126 loc) · 3.71 KB
/
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
demosBox = document.getElementById("demos-box");
demosBox.addEventListener("click", (e) => {
let anchor = document.createElement("a");
anchor.href = "/main-demos/";
document.body.appendChild(anchor);
anchor.click();
});
/* NOTE: THIS FILE ISN'T USED ANYMORE
* DEMOS SHOULD GO IN THE JS FILE OF THE "main-demos" FOLDER
* TUTORIALS SHOULD GO IN THE JS FILE OF THE "main-tutorials" FOLDER
*/
let interactiveTutorials = {
arraysDemo: {
path: 'arrays-demo',
title: 'ARRAYS DEMO',
content: 'Learn how Javascript arrays work'
},
arraysTutorial: {
path: 'arrays-tutorial',
title: 'ARRAYS TUTORIAL',
content: 'Learn how Javascript arrays work'
},
attributeDemo: {
path: "attribute-demo",
title: "ATTRIBUTE DEMO",
content:
"Learn how attributes work inside tags and the most commonly used ones.",
},
divDemo: {
path: "div-demo",
title: "<DIV> TAG DEMO",
content: "How to use the <div> tag and an exploritory tutorial.",
},
boxModel: {
path: "box-model-demo",
title: "BOX MODEL DEMO",
content:
"Margin, border, padding. Every HTML element has these, what do they do?",
},
booleanLogic: {
path: "boolean-logic-demo",
title: "BOOLEAN LOGIC DEMO",
content: "How do booleans work? What are operators and statements?",
},
domDemo: {
path: "dom-demo",
title: "DOM DEMO",
content: "The Document Object Model and how to manipulate it.",
},
functionDemo: {
path: "function-demo",
title: "FUNCTION DEMO",
content: "Condensing code and calling upon functions!",
},
loopDemo: {
path: "for-loop-demo",
title: "FOR LOOP DEMO",
content: "Explore how the for loop works with a bot-a-pillar!",
},
mathRandom: {
path: "math-random-demo",
title: "MATH.RANDOM FUNCTION DEMO",
content:
"How does the Math.random function work? How can it be modified to fit specific needs?",
},
eventsDemo: {
path: "events-demo",
title: "EVENTS DEMO",
content: "What are events in JavaScript, and how can we use them?",
},
objectDemo: {
path: "object-demo",
title: "OBJECT DEMO",
content:
"What are objects in JavaScript? This tutorial shows the syntax of a JSON object with a neat car that changes color!",
},
truthyFalsyDemo: {
path: 'truthy-falsy-demo',
title: 'TRUTHY AND FALSY VALUES DEMO',
content: "What are truthy and falsy values in JavaScript? What expressions evaluate to boolean false?"
},
cssSelectorsDemo: {
path: 'css-selectors-demo',
title: 'CSS SELECTORS DEMO',
content: 'What are CSS selectors and what are some basic ways to use them?'
},
whileLoopDemo: {
path: "while-loop-demo",
title: "WHILE LOOP DEMO",
content: "What are while loops and do while loops?",
},
ifElseDemo: {
path: "if-else-demo",
title: "IF ELSE DEMO",
content: "What is and If / Else Statement",
},
};
tutorialsBox = document.getElementById("tutorials-box");
tutorialsBox.addEventListener("click", (e) => {
let anchor = document.createElement("a");
anchor.href = "/main-tutorials/";
document.body.appendChild(anchor);
anchor.click();
});
mainPic1 = document.getElementById("main-pic-1");
mainPic2 = document.getElementById("main-pic-2");
window.addEventListener("resize", (e) => {
if (window.innerWidth < 1000) {
mainPic1.style = "display:none;";
mainPic2.style = "display:none;";
}
if (window.innerWidth >= 1000) {
mainPic1.style = "";
mainPic2.style = "";
}
});
window.addEventListener("DOMContentLoaded", (e) => {
if (window.innerWidth < 1000) {
mainPic1.style = "display:none;";
mainPic2.style = "display:none;";
}
if (window.innerWidth >= 1000) {
mainPic1.style = "";
mainPic2.style = "";
}
});