-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoggleSidebar.js
30 lines (28 loc) · 1.3 KB
/
toggleSidebar.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
if (typeof sidebarOpen == 'undefined') {console.log("sidebar not set for this url pattern");}
else {
if (!sidebarOpen) { //if closed
$('html').animate({ "width": "-=" + width}, { //reduce width of main html doc
'duration': 'slow',
'easing': 'easeInOutCirc'
});
$('.todo-sidebar').animate({ "right": "+=" + width}, { //reduce width of main html doc
'duration': 'slow',
'easing': 'easeInOutCirc'
});
sidebarOpen = true;
console.log("sidebar open");
}
else { //if open
$('html').animate({ "width": "+=" + width}, { //increase width of main html doc
'duration': 'slow',
'easing': 'easeInOutCirc'
});
$('.todo-sidebar').animate({ "right": "-=" + width}, { //reduce width of main html doc
'duration': 'slow',
'easing': 'easeInOutCirc'
});
//document.getElementsByClassName('todo-sidebar')[0].remove();
sidebarOpen = false;
console.log("sidebar closed");
}
}