jQuery on() stopPropagation not working?

后端 未结 4 1354
陌清茗
陌清茗 2020-12-05 14:08

I can\'t seem to get this to stop propagating..

  $(document).ready(function(){
      $(\"body\").on(\"click\",\"img.theater\",function(event){ 
          ev         


        
4条回答
  •  囚心锁ツ
    2020-12-05 15:15

    The best way to do that is :

    $(".theater-wrapper").click(function(event){
        if (!$(event.target).is('img.theater')){
            $('.theater-wrapper').hide();
        }
    }); 
    

    It's working for me with an accordion and checkbox

提交回复
热议问题