forked from access42/AccesSlide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slide.js
27 lines (20 loc) · 945 Bytes
/
slide.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
/* This file may contains your javascript features */
function changeColors (newCSS){
document.getElementById('currentCSS').href = '../css/themes/'+newCSS+('.css');
};
var n = document.getElementById('wrappernav');
n.classList.add('is-closed');
function navi() {
if (window.matchMedia("(max-width:40em)").matches && document.getElementById("toggle-nav")==undefined) {
n.insertAdjacentHTML('afterBegin','<button id="toggle-nav" class="toogle-btn"><span class="icon-fallback-text"><span class="icon icon-plus" aria-hidden="true"></span><span class="text">Show links</span></span></button>');
t = document.getElementById('toggle-nav');
t.onclick=function(){
n.classList.toggle('is-closed');
}
}
if (window.matchMedia("(min-width:40em)").matches && document.getElementById("toggle-nav")) {
document.getElementById("toggle-nav").outerHTML="";
}
}
navi();
window.addEventListener('resize', navi);