forked from HPQC-LABS/HPQC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lectures.js
155 lines (127 loc) · 4.51 KB
/
lectures.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
let hover = document.getElementById("face1");
let element = document.getElementById("BKRow");
hover.addEventListener("mouseover", function(event){
$(element).css("transform", "rotateY(10deg)");
});
hover.addEventListener("mouseout", function(event){
$(element).css("transform", "rotateY(0deg)");
});
*/
const card = document.querySelectorAll('.itemInner');
card.forEach((card) => {
card.addEventListener("click", () => {
card.classList.toggle("is-flipped");
});
});
/*For 1st Lecture box*/
let TD = document.getElementById('TDInfo');
let TDTxt = document.getElementById('TDDesc');
let TDToggle = document.getElementById('TDRow');
$(TDToggle).click(function(){
if($(TD).height() != 0){
$(TD).animate({height: 0}, 1000);
$(TDTxt).slideUp(1000);
}
else{
$(TD).animate({height: "100%"}, 1000);
$(TDTxt).slideDown(1000);
$(TDTxt).css("display", "block");
}
document.getElementById('TDArrow').classList.toggle('rotated');
});
/*For 2nd Lecture box*/
let EB = document.getElementById('EBInfo');
let EBTxt = document.getElementById('EBDesc');
let EBToggle = document.getElementById('EBRow');
$(EBToggle).click(function(){
if($(EB).height() != 0){
$(EB).animate({height: 0}, 1000);
$(EBTxt).slideUp(1000);
}
else{
$(EB).animate({height: "100%"}, 1000);
$(EBTxt).slideDown(1000);
$(EBTxt).css("display", "block");
}
document.getElementById('EBArrow').classList.toggle('rotated');
});
/*For 3rd Lecture box*/
let BK = document.getElementById('BKInfo');
let BKTxt = document.getElementById('BKDesc');
let BKToggle = document.getElementById('BKRow');
$(BKToggle).click(function(){
if($(BK).height() != 0){
$(BK).animate({height: 0}, 1000);
$(BKTxt).slideUp(1000);
}
else{
$(BK).animate({height: "100%"}, 1000);
$(BKTxt).slideDown(1000);
$(BKTxt).css("display", "block");
}
document.getElementById('BKArrow').classList.toggle('rotated');
});
//Once the webpage is loaded, if the width is resized, the webpage will refresh
//This is due to the way in which the entries are styled. Because they take in the height and width
//from a singular entry, if the webpage is resized the formatting won't be updated unless the page is refreshed
$(document).ready(function () {
var width = document.body.clientWidth;
$(window).on('resize', function () {
var newWidth = document.body.clientWidth;
//The reload must only happen when the width is changed as it can cause issues on mobile
//if it checks for changes in the height as well.
if(width != newWidth){
location.reload();
}
});
});
/* Additional code for upcoming lectures once they are finished
//For 4th Lecture box
let LZ = document.getElementById('LZInfo');
let LZTxt = document.getElementById('LZDesc');
let LZToggle = document.getElementById('LZRow');
$(LZToggle).click(function () {
if ($(LZ).height() != 0) {
$(LZ).animate({ height: 0 }, 1000);
$(LZTxt).slideUp(1000);
}
else {
$(LZ).animate({ height: "100%" }, 1000);
$(LZTxt).slideDown(1000);
$(LZTxt).css("display", "block");
}
document.getElementById('LZArrow').classList.toggle('rotated');
});
/*For 5th Lecture box*/
let AO = document.getElementById('AOInfo');
let AOTxt = document.getElementById('AODesc');
let AOToggle = document.getElementById('AORow');
$(AOToggle).click(function () {
if ($(AO).height() != 0) {
$(AO).animate({ height: 0 }, 1000);
$(AOTxt).slideUp(1000);
}
else {
$(AO).animate({ height: "100%" }, 1000);
$(AOTxt).slideDown(1000);
$(AOTxt).css("display", "block");
}
document.getElementById('AOArrow').classList.toggle('rotated');
});
/*For 6th Lecture box*/
let GL = document.getElementById('GLInfo');
let GLTxt = document.getElementById('GLDesc');
let GLToggle = document.getElementById('GLRow');
$(GLToggle).click(function () {
if ($(GL).height() != 0) {
$(GL).animate({ height: 0 }, 1000);
$(GLTxt).slideUp(1000);
}
else {
$(GL).animate({ height: "100%" }, 1000);
$(GLTxt).slideDown(1000);
$(GLTxt).css("display", "block");
}
document.getElementById('GLArrow').classList.toggle('rotated');
});