-
-
Notifications
You must be signed in to change notification settings - Fork 574
/
Copy pathscript.js
46 lines (43 loc) · 1.41 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
const header = document.getElementById("header");
const title = document.getElementById("title");
const excerpt = document.getElementById("excerpt");
const profile_img = document.getElementById("profile-img");
const name = document.getElementById("name");
const date = document.getElementById("date");
const today = new Date();
const monthNames = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
];
const animated_bgs = document.querySelectorAll(".animated-bg");
const animated_bg_texts = document.querySelectorAll(".animated-bg-text");
const getData = () => {
header.innerHTML =
'<img src="https://images.unsplash.com/photo-1610751399547-46ad575447cf?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80" alt="" />';
title.innerHTML = "Lorem ipsum dolor sit amet";
excerpt.innerHTML =
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolore perferendis";
profile_img.innerHTML =
'<img src="https://randomuser.me/api/portraits/men/45.jpg" alt="" />';
name.innerHTML = "John Doe";
date.innerHTML = `${
monthNames[today.getMonth()]
} ${today.getDate()}, ${today.getFullYear()}`;
animated_bgs.forEach((background) =>
background.classList.remove("animated-bg")
);
animated_bg_texts.forEach((background) =>
background.classList.remove("animated-bg-text")
);
};
setTimeout(getData, 2500);