-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
43 lines (38 loc) · 1.33 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const headerNamePrimary = document.querySelector('.header-name__primary');
const headerNameAlt = document.querySelector('.header-name__alt');
const allIcons = document.querySelectorAll('.icon');
const mailIcon = document.querySelector('#mail')
const resetHeaderNamePrimary = function() {
headerNamePrimary.classList.toggle('hide');
headerNameAlt.innerHTML = "";
}
function copyTextToClipboard() {
var emailAddress = 'hey@anthonybronkema.com';
navigator.clipboard.writeText(emailAddress).then(function() {
headerNameAlt.innerHTML = "email addy saved to clipboard!"
}, function() {
headerNameAlt.innerHTML = "copy to clipboard failed."
})
}
const setAlternateText = function(event) {
if (event.target.id === "code") {
headerNameAlt.innerHTML = "github/abronkema";
}
if (event.target.id === "mail") {
headerNameAlt.innerHTML = "send me a note";
}
};
mailIcon.addEventListener("click", copyTextToClipboard);
allIcons.forEach(function(el) {
if (el.id == "mail") {
el.addEventListener('click', function(el) {
})
}
el.addEventListener('mouseover', function(event) {
resetHeaderNamePrimary();
setAlternateText(event);
});
el.addEventListener('mouseleave', function(event) {
resetHeaderNamePrimary();
});
});