点击除指定区域外,div消失

$(function(){
  $(document).bind("click",function(e) {
    var t = $(e.target);		
    //#in,.dd 为指定的区域,#box为想消失的div
    if(!t.is('#in') && !t.is("#box") && !t.is(".dd")) {
      if ($('#box').is(':visible') ) {  
        $('#box').hide();                                                    
      }
    }
  })
})

  

原文地址:https://www.cnblogs.com/xuehuashanghe/p/10621898.html