标签:hid document return stop targe on() jquer jquery hide
<ul class="menu_level1">
<li><a>张三</a></li>
<li><a>李四</a></li>
<li><a>王五</a></li>
<li><a>click me!</a>
<div class="menu_level2">搬砖侠</div>
</li>
</ul>
$(‘.menu_level1 li‘).click(function(event){
event.stopPropagation();
$(".menu_level2").show();
})
$(document).click(function(e){
var target = $(e.target);
if(target.closest(".menu_level1").length != 0) return;
$(".menu_level2").hide();
})
父级class .gallery.transition
子级class .gallery.transition .inner
$(‘.gallery.transition ‘).click(
function(){
$(this).hide()
}
)
$(‘.gallery.transition .inner‘).click(
function(e){
e.stopPropagation()
}
)
标签:hid document return stop targe on() jquer jquery hide
原文地址:https://www.cnblogs.com/cn-oldboy/p/12944033.html