click outside div in depth angular code example
Example: jquery how to detect click outside off-canvas-navigation
$(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();
}
}
});