jquery how to detect click outside off canvas navigation

Solutions on MaxInterview for jquery how to detect click outside off canvas navigation by the best coders in the world

showing results for - "jquery how to detect click outside off canvas navigation"
Laura
14 Jul 2017
1$(document).mouseup(function(e) {
2    var $offCanvasInner = $(".off-canvas-inner");
3
4    // if the target of the click isn't the $offCanvasInner nor a descendant of the container
5    if (!$offCanvasInner.is(e.target) && $offCanvasInner.has(e.target).length === 0) {
6      if($('.off-canvas-wrapper').css('display') == "block"){
7        $('.off-canvas-wrapper').hide();
8      }
9    }
10
11});