您的位置:首页 > Web前端 > JQuery

jQuery实现鼠标点击div外的地方div隐藏

2018-01-13 11:28 381 查看
html

<div id="big">
<div id="small"></div>
</div>css
#big{
width: 500px;
height: 500px;
background-color: #000;
}
#small{
width: 50px;
height: 50px;
background-color: #f00;
}js
$("#big").on("tap", function(e) {
if(e.target == this) {
$('#small').hide();
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: