I recently created a unique "slide-out" menu which you can check out here: SASS Slide-out Menu.
While it is functional, I am looking to add a feature where clicking outside of the menu will automatically close it by removing the "nav-open" class.
I attempted to implement this functionality in the codepen demo, but unfortunately, it did not work as expected:
window.on("click", function(e) {
if(wrapper.hasClass("nav-open") && e.target != nav && e.target.parent() != nav) {
wrapper.removeClass("nav-open");
}
});