-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavbar.html
211 lines (148 loc) · 6.57 KB
/
navbar.html
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,800;0,900;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/style/navbar.css">
<link rel="stylesheet" href="/style/courses_btn.css">
<title>Document</title>
</head>
<body>
<div class="space-bet-flex navbar">
<div class="space-bet-flex left-nav ">
<div class="nav-logo"> up<span class="nav-logo-span">G</span>rad</div>
<div class=" space-bet-flex btn-style courses-btn" id="courses-btn">Courses<i class="fas fa-angle-down arrow"></i>
</div>
</div>
<div class="space-bet-flex right-nav">
<div class="space-bet-flex text-btn-container">
<div class="nav-text-btn">HIRE FROM UPGRAD</div>
<div class="nav-text-btn">STUDY ABROAD</div>
<div class="nav-text-btn">FOR BUSINESS</div>
<div class="nav-text-btn ">
MORE
<i class="fas fa-angle-down arrow">
</i>
<div class="more">
<h3 class="more-dropdown-text">Mentorship</h3>
<h3 class="more-dropdown-text">Short Videos</h3>
<h3 class="more-dropdown-text">Live MasterClass</h3>
<h3 class="more-dropdown-text">Master Class</h3>
<h3 class="more-dropdown-text">Refer and Earn</h3>
<h3 class="more-dropdown-text">Blog</h3>
<h3 class="more-dropdown-text">Become A Business Associate</h3>
</div>
</div>
</div>
<div class="btn-style space-bet-flex" id="sign-up-btn">Sign Up</div>
</div>
</div>
</body>
</html>
<script type="module">
import {mba_DB,ds_DB,ml_DB,bc_DB} from "./db.js"
let course_btn = document.getElementById("courses-btn");
// course_btn.addEventListener("mouseenter",);
courseByCateg();
function courseByCateg() {
let container = document.createElement("div");
container.setAttribute("id","crslist-box");
let arrow = document.createElement("i");
arrow.setAttribute("class","fas");
arrow.classList.add("fa-angle-right")
let mba = document.createElement("div");
mba.setAttribute("class","single-course-box");
mba.value = "mba";
let mba_title = document.createElement("h3");
mba_title.innerText = `MBA (${(JSON.parse(mba_DB()).length)})`;
mba.append(mba_title,arrow);
let ds = document.createElement("div");
ds.setAttribute("class","single-course-box");
ds.value = "ds";
let ds_title = document.createElement("h3");
ds_title.innerText = `Data Science (${(JSON.parse(ds_DB()).length)})`;
let arrow1 = document.createElement("i");
arrow1.setAttribute("class","fas");
arrow1.classList.add("fa-angle-right")
ds.append(ds_title,arrow1);
let ml = document.createElement("div");
ml.setAttribute("class","single-course-box");
ml.value = "ml";
let ml_title = document.createElement("h3");
ml_title.innerText = `AI | ML (${(JSON.parse(ml_DB()).length)})`;
let arrow2 = document.createElement("i");
arrow2.setAttribute("class","fas");
arrow2.classList.add("fa-angle-right")
ml.append(ml_title,arrow2);
let bc = document.createElement("div");
bc.setAttribute("class","single-course-box");
bc.value = "bc";
let bc_title = document.createElement("h3");
bc_title.innerText = `Technology & Blockchain (${(JSON.parse(bc_DB()).length)})`;
let arrow3 = document.createElement("i");
arrow3.setAttribute("class","fas");
arrow3.classList.add("fa-angle-right")
bc.append(bc_title,arrow3);
let hr1 = document.createElement("hr");
let hr2 = document.createElement("hr");
let hr3 = document.createElement("hr");
// let hr4 = document.createElement("hr");
let di = document.createElement("div");
di.setAttribute("id","dc-container")
container.append(mba,hr1,ds,hr2,ml,hr3,bc);
course_btn.append(container,di);
}
let courseBoxArr = document.getElementsByClassName("single-course-box");
for(let i=0; i<courseBoxArr.length; i++) {
courseBoxArr[i].addEventListener("mouseenter",()=>{
let value = courseBoxArr[i].value;
if(value=="mba") {
let data = JSON.parse(mba_DB());
showHowerCourse(data);
} else if(value=="ds") {
let data = JSON.parse(ds_DB());
showHowerCourse(data);
} else if(value=="ml") {
let data = JSON.parse(ml_DB());
showHowerCourse(data);
} else if(value=="bc") {
let data = JSON.parse(bc_DB());
showHowerCourse(data);
}
})
}
function showHowerCourse(data) {
let course_container = document.getElementById("dc-container");
course_container.innerHTML = "";
data.forEach(element => {
let course_card = document.createElement("div");
course_card.setAttribute("class","course-card");
let img_div = document.createElement("div");
let img = document.createElement("img");
img.src = element.homePg.logoimg;
img_div.append(img);
let course_detail = document.createElement("div");
course_detail.setAttribute("class","course-detail-in-card");
let h3 = document.createElement("h3");
h3.innerText = element.homePg.title;
let p = document.createElement("p");
p.innerText = element.homePg.institute;
let duration = document.createElement("h4");
duration.innerText = element.homePg?.duration;
course_detail.append(h3,p,duration);
let arrow_div = document.createElement("div");
let arrowRight = document.createElement("i");
arrowRight.setAttribute("class","fas");
arrowRight.classList.add("fa-arrow-right");
arrow_div.append(arrowRight);
course_card.append(img_div,course_detail,arrow_div);
course_container.append(course_card);
});
course_btn.append(course_container);
}
</script>