I have a menu that I toggle when a button is clicked, and when you click off of it or on a link inside of it, it then hides. I also have it set up so that the esc key will close it, but I was curious if I could somehow combine them into one? Heres that I have so far.. everything i've tried doesn't seem to work so if someone could point me in the right direction that would be awesome - Thanks!
//Toggle functionality for menu
$(function(){
var effect = 'slide';
var options = { direction: 'left'};
var duration = 500;
//Slide toggle menu
$('#m').click(function () {
$('#mOpt').toggle(effect, options, duration);
});
//Slides menu left to hide when clicking on any <section>
I have a menu that I want to slide toggle in from the left to the right. I would also like to hide the menu when I click off the the menu or when I click the esc key, but I want it to slide back to the left. Here is what I wrote... It seems to work fine, but i'd like to know if it just works or if its actually well-written.