我似乎无法得到这个停止传播..jQuery on()stopPropagation不工作?
$(document).ready(function(){
$("body").on("click","img.theater",function(event){
event.stopPropagation();
$('.theater-wrapper').show();
});
// This shouldn't fire if I click inside of the div that's inside of the
// `.theater-wrapper`, which is called `.theater-container`, anything else it should.
$(".theater-wrapper").click(function(event){
$('.theater-wrapper').hide();
});
});
我所有的内容都是通过AJAX –
加载到页面@DylanCross - 在这种情况下,你应该使用哪一个我在答复中提到的另一种方法。保持“on”事件处理的原样。 – ShankarSangoli
是的,当我点击的时候点击它不应该关闭的位置时它仍然关闭。 –