分享一款漂亮的后台多级菜单特效,点击菜单可伸缩展开。
0、请不要问“在不在”之类的问题,有问题直接问!1、学生或暂时没有工作的童鞋,整站资源免费下载!2、¥9.9充值终身VIP会员,加我微信,826096331 拉你进VIP群学习!3、程序员加油,技术改变世界。在线 充值
HTML
我们在#menu多个li一级菜单,在它的next节点放置二级菜单ul和三级菜单ul li ul
jQuery
菜单点击事件
function c(srcelement) {
var targetid, srcelement, targetelement;
var strbuf;
//-------- 如果点击了展开或收缩按钮---------
targetid = srcelement.id + "d";
targetelement = document.getElementById(targetid);
if (targetelement.style.display == "none") {
srcelement.className = "active";
targetelement.style.display = '';
menu_flag = 0;
expand_text.innerHTML = "收缩";
} else {
srcelement.className = "";
targetelement.style.display = "none";
menu_flag = 1;
expand_text.innerHTML = "展开";
var links = document.getElementsByTagName("A");
for (i = 0; i < links.length; i++) {
srcelement = links[i];
if (srcelement.parentNode.className.toUpperCase() == "l1" && srcelement.className == "active" && srcelement.id.substr(0, 1) == "m") {
menu_flag = 0;
expand_text.innerHTML = "收缩";
break;
}
}
}
}
设置当前菜单选中样式
function set_current(id) {
cur_link = document.getElementById("f" + cur_id) if (cur_link) cur_link.className = "";
cur_link = document.getElementById("f" + id);
if (cur_link) cur_link.className = "active";
cur_id = id;
}
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群