-
Notifications
You must be signed in to change notification settings - Fork 1
/
hall.js
36 lines (30 loc) · 1012 Bytes
/
hall.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
var response;
var data;
fetchData();
async function fetchData() {
response = await fetch('HOF.csv');
$(document).ready(getData);
}
async function getData() {
data = await response.text();
const rows = data.split('\n').slice(1);
rows.pop();
const loop = rows.forEach((row, index) => {
const elt = row.split(',');
var element = " <a class=\"carousel-item-image\" href=\"alumniinfo.html?key=" + index + "\"><img src ='assets/" + elt[3] + "' height=300px width=200px/></a> <h5>" +
elt[0] + "</h5> <h6>" + elt[2] + " Wing" + " '" + elt[1].substring(2) + "</h6>";
var elem = document.createElement("div");
elem.className = "carousel-item";
elem.innerHTML = element;
document.getElementById(elt[1]).appendChild(elem);
});
await loop;
$(".carousel").carousel({
duration: 200,
});
autoplay();
function autoplay() {
$('.carousel').carousel('next');
setTimeout(autoplay, 2000);
}
}