亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How to use jQuery to hide the menu by clicking elsewhere on the page?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-06-15 09:21:47
0
3
738

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級(jí)PHP講師

reply all(3)
習(xí)慣沉默

You should look like this

$(document).bind("click",function(e){ 
    //通過(guò)e.target判斷
} 

e.target != "You click on the element that needs to be displayed" then execute hide()

迷茫

$("#a").on("click", function(e){

if($(".class").is(":hidden")){
    $(".class").show();
}else{
    $(".class").hide();
}

$(document).one("click", function(){
    $(".class").hide();
});

e.stopPropagation();

});
$(".class").on("click", function(e){

e.stopPropagation();

});

學(xué)習(xí)ing

There is no problem with this answer, it is quite correct

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template