-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (34 loc) · 1.05 KB
/
index.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
$(document).ready(() => {
for(let i = 0; i < articles.length; i++){
let images = '<div class="imageContainer">';
for(let j = 0; j < articles[i].images.length; j++){
images += '<img src="'
+ articles[i].images[j].src
+ '" alt="'
+ articles[i].images[j].alt
+ '" />';
}
images += '</div>';
$(".articleContainer").append('<div id="spacer'
+ articles[i].title
+ '" style="height: 15vh;"></div><div id="'
+ articles[i].title
+ '" class="article"><h2>'
+ articles[i].title
+ '</h2><h3>'
+ articles[i].date
+ '</h3>'
+ images
+ '<p>'
+ articles[i].content
+ '</p></div>');
$(".nav").append('<button id="nav'
+ articles[i].title
+ '">'
+ articles[i].title + '<br>' + articles[i].date
+ '</button>');
$("#nav"+articles[i].title).click(() => {
$("#spacer" + articles[i].title)[0].scrollIntoView();
});
}
});