html代码
<div id="detailMsg" class="showDiv" style="margin: 0 0 0 200px;"> .... //弹出框内具体内容省略 </div>
js代码(引入jquery)
$(function () { $("#detailMsg").click(function(e){ e= e || window.event; if(e.cancelBubble) e.cancelBubble = true; else e.stopPropagation(); }); $("body").click(function(){ $(‘#detailMsg‘).css("display","none"); });});
div 弹出框 点击周围空白处消失
时间: 2024-10-07 08:03:59