The main function is to click on display, and then click anywhere on the page to turn off the display effect. It is mainly the function of $(document).click
There are often some pop-up layers during development. After popping up, they must be automatically closed when clicking on other places of the page. The following is the implementation code:
HTML code:
Copy the codeThe code is as follows:
<div class="down">click</div>
<div class="con hide">show-area</div>
CSS code:
.hide{display:none;}
JS Code
Copy the codeThe code is as follows:
$(document).ready(function(){
$("").click(function(e){
();
$("").removeClass("hide");
});
$(document).click(function(){
if(!$("").hasClass("hide")){
$("").addClass("hide");
}
});
});
OK, test it locally and modify the css style by yourself!