$(".car-style").click(function(){
$(".operate-mask-outer").show();
// 点击黄色的禁停站,弹出框显示
});
$("#operateMask").click(function(){
$(".operate-mask-outer").hide();
// 点击灰色边缘的地方,弹出框消失
})
$(".stopover-station").click(function(event){
$(".operate-mask-outer").show();
event.stopPropagation();
// 阻止冒泡的关键代码
// 点击弹出框内部,弹出框不消失
})
想要阻止事件冒泡,在方法里面加这个代码就可以了 event.stopPropagation();
需要注意的是:event是和方法里面的参数一样的