<script>
$(function(){
$(document).click(function (e) {
if (!$(e.target).is('.program_rooms')) {
$(".room_change").slideUp('slow');
$(".program_rooms").attr("data-sure","0");
}
});
})
</script>
$('body').click(function(e) {
var target = $(e.target);
// 如果#overlay或者#btn下面还有子元素,可使用
// !target.is('#btn *') && !target.is('#overlay *')
if(!target.is('#btn') && !target.is('#overlay')) {
if ( $('#overlay').is(':visible') ) $('#overlay').hide();
}
});
$('body').click(function(e) {
if(e.target.id != 'btn' && e.target.id != 'overlay')
if ( $('#overlay').is(':visible') ) $('#overlay').hide();
})
<script>
$(function(){
$(document).bind("click",function(e){
//id为menu的是菜单,id为open的是打开菜单的按钮
if($(e.target).closest("#menu").length == 0 && $(e.target).closest("#open").length == 0){
//点击id为menu之外且id不是不是open,则触发
close();
}
})
})
function close(){
//close menu...
}
function open(){
//open menu...
}
</script>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有