-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (25 loc) · 750 Bytes
/
index.js
File metadata and controls
28 lines (25 loc) · 750 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
'use strict';
(function() {
window.addEventListener('load', init);
/**
* Add initial event listeners.
*/
function init() {
showLinkEmojiOnHover();
}
/**
* Add event listeners to headers such that the link emoji will be shown iff
* the user is hovering over a header.
*/
function showLinkEmojiOnHover() {
let sections = document.querySelectorAll('.main-content h1, .main-content h2');
for (let i = 0; i < sections.length; i++) {
sections[i].addEventListener('mouseover', function() {
this.querySelector('span').classList.remove('hidden');
});
sections[i].addEventListener('mouseout', function() {
this.querySelector('span').classList.add('hidden');
});
}
}
})();