44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
window.onload = function(){
|
|
var getNavi = document.getElementById('navigation');
|
|
|
|
var mobile = document.createElement("span");
|
|
mobile.setAttribute("id","mobile-navigation");
|
|
getNavi.parentNode.insertBefore(mobile,getNavi);
|
|
|
|
document.getElementById('mobile-navigation').onclick = function(){
|
|
var a = getNavi.getAttribute('style');
|
|
if(a){
|
|
getNavi.removeAttribute('style');
|
|
document.getElementById('mobile-navigation').style.backgroundImage='url(./api.php?call=files&cat=images&id=mobile-menu.png)';
|
|
} else {
|
|
getNavi.style.display='block';
|
|
document.getElementById('mobile-navigation').style.backgroundImage='url(./api.php?call=files&cat=images&id=mobile-close.png)';
|
|
}
|
|
};
|
|
var getElm = getNavi.getElementsByTagName("LI");
|
|
for(var i=0;i<getElm.length;i++){
|
|
if(getElm[i].children.length>1){
|
|
var smenu = document.createElement("span");
|
|
smenu.setAttribute("class","mobile-submenu");
|
|
smenu.setAttribute("OnClick","submenu("+i+")");
|
|
getElm[i].appendChild(smenu);
|
|
};
|
|
};
|
|
submenu = function (i){
|
|
var sub = getElm[i].children[1];
|
|
var b = sub.getAttribute('style');
|
|
if(b){
|
|
sub.removeAttribute('style');
|
|
getElm[i].lastChild.style.backgroundImage='url(./api.php?call=files&cat=images&id=mobile-expand.png)';
|
|
getElm[i].lastChild.style.backgroundColor='rgba(11, 163, 156, 0.7)';
|
|
} else {
|
|
sub.style.display='block';
|
|
getElm[i].lastChild.style.backgroundImage='url(./api.php?call=files&cat=images&id=mobile-collapse.png)';
|
|
getElm[i].lastChild.style.backgroundColor='rgba(0,0,0,0.8)';
|
|
}
|
|
};
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
new SYSTEM('./api.php',1,'start');
|
|
}); |