Home  >  Article  >  Web Front-end  >  JQuery realizes clicking outside the div to hide the div window_jquery

JQuery realizes clicking outside the div to hide the div window_jquery

WBOY
WBOYOriginal
2016-05-16 17:22:401185browse

jquery realizes that the div window disappears when the mouse clicks outside the div

Copy the code The code is as follows:





Web page special effects display center







Click on a blank space to specify the div to hide and disappear



Copy code The code is as follows:

The div with class="bigPic" is displayed Or a hidden div, in addition. case > ul > li is the parent element of class="bigPic"

$("body").bind("click",function(evt){
if($(evt.target).parents(".case > ul > li").length==0)
{
$('.bigPic').hide();
}

});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn