📜  jquery如何检测off-canvas-navigation之外的点击 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:56.488000             🧑  作者: Mango

代码示例1
$(document).mouseup(function(e) {
    var $offCanvasInner = $(".off-canvas-inner");

    // if the target of the click isn't the $offCanvasInner nor a descendant of the container
    if (!$offCanvasInner.is(e.target) && $offCanvasInner.has(e.target).length === 0) {
      if($('.off-canvas-wrapper').css('display') == "block"){
        $('.off-canvas-wrapper').hide();
      }
    }

});