$('.menu ul li:nth-of-type(4)').click(function(event){
if($(".menu_bg").is(":visible")){
$('.menu_bg').hide();
$('.menu ul li:nth-of-type(4)>a').text('案例+');
$(document).one("click",function(){
$('.menu_bg').show();
$('.menu ul li:nth-of-type(4)>a').text('案例-');
});
}else{
$('.menu_bg').show();
$('.menu ul li:nth-of-type(4)>a').text('案例-');
$(document).one("click",function(){
$('.menu_bg').hide();
$('.menu ul li:nth-of-type(4)>a').text('案例+');
});
}
event.stopPropagation();
});
$("#menu_bg").click(function (event) {
event.stopPropagation();//在Div区域内的点击事件阻止冒泡到document
});
转载于:https://www.cnblogs.com/hongweizhiyuan/p/7169412.html