I am making my own responsive navigation from this tut: http://www.hongkiat.com/blog/responsive-web-nav/
This is my fiddle: http://jsfiddle.net/2Pqch/
When window is minimized and you press the open/close btn I would like to be able to close it either by clicking the button or by clicking outside the nav.
How can this function be added?
Here is the script:
$(function() {
var pull = $('.btn');
menu = $('nav ul');
menuHeight = menu.height();
$(pull).on('click', function(e) {
e.preventDefault();
menu.slideToggle();
});
$(window).resize(function(){
var w = $(window).width();
if(w > 320 && menu.is(':hidden')) {
menu.removeAttr('style');
}
});
});