-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathticker.js
More file actions
33 lines (31 loc) · 967 Bytes
/
ticker.js
File metadata and controls
33 lines (31 loc) · 967 Bytes
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
const totallyunique = document.getElementById("marqueediv");
// MARQUEE CONTAINER
class divLoad {
divLoad() {
totallyunique.innerHTML = `<div class="marquee__inner" aria-hidden="true">
<span class="marquee__text" id="marquee"> </span>
</div>`;
}
}
class tickerValues {
constructor(ticker, companyName, price, changesPercentage) {
this.ticker = ticker;
this.companyName = companyName;
this.price = price;
this.changesPercentage = changesPercentage;
}
changeHtml(tag) {
let innerclass = "green";
if (this.changesPercentage < 0) {
innerclass = "red";
} else if (this.changesPercentage === 0) {
innerclass = "white";
}
tag.innerHTML += ` ${this.ticker} ${this.companyName} $${this.price} <i class="${innerclass}">${this.changesPercentage} </i> --`;
}
}
document.addEventListener("DOMContentLoaded", () => {
const div = new divLoad();
div.divLoad();
});
// INTIALIZATION OF GETPAGE() ON DOM LOAD