New to jQuery... does this function look well-written?

New to jQuery... does this function look well-written?

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.

//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 on key up esc
    $(document).on('keyup',function(e) {
       if (e.keyCode == 27) {
        $('#mOpt').animate({display:'none'}, 0, function() { 
            $(this).hide(effect, options, duration);
        });
       }
    });

    //Slides menu left to hide when clicking on any <section>
    $('section').click(function(){ 
        $('#mOpt').animate({display:'none'}, 0, function() {
            $(this).hide(effect, options, duration);
        });
    });
});