-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.js
executable file
·83 lines (62 loc) · 1.87 KB
/
menu.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"use strict";
(function(exports){
var list_container = [];
function MMMenu_init(){
list_container = document.getElementsByClassName("MMMenu-container");
console.log("init",list_container.length);
};
exports.init = MMMenu_init;
})(this.MMMenu = {});
/* Class for accordeon menu*/
function DropFuncClass(id,idonclick,idcaret,options) {
var _memId = id+'_status',
_status = localStorage.getItem(_memId);
var _ele, _caret;
if(options){
var _son = options['son'],
_opposite = options['opposite'];
}
_status = (_status==='open') ? 'open' :'closed';
var that = this;
this.init = function(){
_ele = document.getElementById(id);
document.getElementById(idonclick).onclick = that.flipmenu;
_caret = document.getElementById(idcaret);
if(_status==='open'){ that.open();}
// var dropmenudict = JSON.parse(localStorage.getItem("dropmenudict"));
// dropmenudict = dropmenudict || {};
// dropmenudict[_memId] = true;
// console.log(dropmenudict)
// localStorage.setItem("dropmenudict",JSON.stringify(dropmenudict));
};
this.close = function (waittime) {
waittime = waittime | 0;
setTimeout(
function(){
// _ele.style.visibility = 'hidden';
_caret.className = _caret.className.replace("caret-up","caret-down");
_ele.style.display = 'none';
}, waittime);
if(_son){_son.close(0);}
_status = 'closed';
};
this.open =function (waittime) {
waittime = waittime | 0;
setTimeout(
function(){
// _ele.style.visibility = 'visible';
_caret.className = _caret.className.replace("caret-down","caret-up");
_ele.style.display = 'block';
},waittime);
if(_opposite){_opposite.close(0);}
_status = 'open';
};
this.flipmenu = function(){
if(_status==='closed'){
that.open();
} else {
that.close();
}
localStorage.setItem(_memId, _status);
};
}