-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinfo.js
More file actions
30 lines (22 loc) · 705 Bytes
/
info.js
File metadata and controls
30 lines (22 loc) · 705 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
var Info = function( title, description ) {
var infoIcon = document.createElement('div');
infoIcon.id = 'info-icon';
infoIcon.textContent = 'i';
document.body.appendChild( infoIcon );
var info = document.createElement('div');
info.id = 'info';
document.body.appendChild( info );
var header = document.createElement('h1');
header.innerHTML = title;
info.appendChild( header );
var body = document.createElement('div');
body.innerHTML = description;
info.appendChild( body );
// how to fade without jQuery?
// $( infoIcon ).click(function(){
// $( info ).fadeToggle('fast');
// });
infoIcon.addEventListener('click', function(e){
info.classList.toggle('visible');
}, false);
};