2014-09-10 14:08:35 +04:00
|
|
|
var menu = {
|
2014-10-13 13:01:44 +04:00
|
|
|
init: function () {
|
2014-09-10 14:08:35 +04:00
|
|
|
this.subMenu();
|
2014-09-13 09:05:50 +04:00
|
|
|
|
|
|
|
// 点击子菜单后消失
|
2014-10-13 13:01:44 +04:00
|
|
|
$(".frame li").click(function () {
|
2014-09-13 09:05:50 +04:00
|
|
|
$(this).closest(".frame").hide();
|
|
|
|
});
|
2014-09-10 14:08:35 +04:00
|
|
|
},
|
2014-10-13 13:01:44 +04:00
|
|
|
disabled: function (list) {
|
|
|
|
for (var i = 0, max = list.length; i < max; i++) {
|
|
|
|
$(".menu li." + list[i]).addClass("disabled");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
undisabled: function (list) {
|
|
|
|
for (var i = 0, max = list.length; i < max; i++) {
|
|
|
|
$(".menu li." + list[i]).removeClass("disabled");
|
|
|
|
}
|
|
|
|
},
|
2014-09-13 09:05:50 +04:00
|
|
|
// 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开
|
2014-10-13 13:01:44 +04:00
|
|
|
subMenu: function () {
|
|
|
|
$(".menu > ul > li > a, .menu > ul> li > span").click(function () {
|
2014-09-10 14:08:35 +04:00
|
|
|
var $it = $(this);
|
|
|
|
$it.next().show();
|
|
|
|
|
|
|
|
$(".menu > ul > li > a, .menu > ul> li > span").unbind();
|
|
|
|
|
2014-10-13 13:01:44 +04:00
|
|
|
$(".menu > ul > li > a, .menu > ul> li > span").mouseover(function () {
|
2014-09-10 14:08:35 +04:00
|
|
|
$(".frame").hide();
|
|
|
|
var $it = $(this);
|
|
|
|
$it.next().show();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|