jQuery Cara mendeteksi klik di luar navigasi off-canvas

$(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();
      }
    }

});
Courageous Camel