You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
998 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

$(document).ready(function(){
function unfoldMenu(pn, cn){
var p = $('strong.menu-p'), c = $('div.menu-c'), cc = $('div.menu-c-current');
if(c.index(cn) != c.index(cc)){
p.removeClass('menu-p-current');
cc.hide(200, function(){
$(this).removeAttr('style').removeClass('menu-c-current');
})
pn.addClass('menu-p-current');
cn.show(200, function(){
$(this).removeAttr('style').addClass('menu-c-current');
});
}
}
function menuHandle(){
$('strong.menu-p').click(function(){
var pn = $(this), cn = pn.next();
unfoldMenu(pn, cn);
});
}
//设置默认下当前展开
function menuCurrent(){
var idx = $('input.menu-code-index').val(), m, pn, cn, p = $('strong.menu-p'), c = $('div.menu-c'), cc = $('div.menu-c-current');
if(/c(\d)+/.test(idx)){ //判断c十进制条件
m = $('a[data-service-index="' + idx + '"]').addClass('current');
cn = m.parents('div.menu-c');
pn = cn.prev();
unfoldMenu(pn, cn);
}
}
menuCurrent();
menuHandle();
});