I require to create a sliding menu from the left. I have successfully create this however to close the menu we need to again touch / click the navigation icon. I need the menu to slide in when someone touches outside the menu area.
Link to what I have done so far. http://rpinvestments.co.in/app/
Following is my JS code:
/*Main Navigation*/
$(function() {
var html = $('html, body'),
navContainer = $('.nav-container'),
navToggle = $('.nav-toggle'),
navDropdownToggle = $('.has-dropdown');
navToggle.on('click', function(e) {
var $this = $(this);
e.preventDefault();
$this.toggleClass('is-active');
navContainer.toggleClass('is-visible');
html.toggleClass('nav-open');
});
navDropdownToggle.on('click', '*', function(e) {
e.stopPropagation();
});
});