-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
28 lines (26 loc) · 800 Bytes
/
app.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
class LinkTo extends HTMLElement {
constructor() {
super();
this.className = 'w3-button w3-round-xlarge w3-theme-l1 w3-border link'
this.target = '_blank'
}
}
class HoverShow extends HTMLElement {
constructor() {
super();
this.className = 'w3-button w3-round-xlarge w3-theme-l1 w3-border link'
this.target = '_blank'
const currentText = this.innerText;
this.onclick = () => {
window.location.replace(this.dataset.href)
}
this.onmouseover = (ev) => {
this.innerText = this.dataset.txt;
}
this.onmouseleave = (ev) => {
this.innerText = currentText;
}
}
}
customElements.define("hover-show", HoverShow);
customElements.define("link-to", LinkTo);