-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
40 lines (38 loc) · 1.13 KB
/
main.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
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize
if ( callback.size != curr_size )
{
callback();
callback.size = curr_size;
}
}
window.addEventListener('resize', function(){
if ( resizing )
{
clearTimeout( resizing );
resizing = null;
}
resizing = setTimeout( done, 50 );
});
// init
callback();
};
}(window));
function openNav() {
document.getElementById("sidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("sidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
document.body.style.backgroundColor = "white";
}