What would be the best option to get the same functionality as ".toggle" for a ".keydown" event?

What would be the best option to get the same functionality as ".toggle" for a ".keydown" event?

What I'm trying to do is display a menu on keydown, having it go away when the key is pressed again. Specifically I'm using the "M" key. Here's my code so far:

  1. $(document).ready(function() {
  2. $('#menu').hide();
  3. $(document).keydown(function(e) { 
  4. if (e.which == 77) {
  5. $('#menu').toggle(function() {
  6. $('#menu').fadeIn('fast');
  7. },function(){
  8. $('#menu').fadeOut('fast');
  9. }
  10. }
  11. });
  12. $('#navNotification').click(function() {
  13. $('#navNotification').fadeOut('slow', function() {
  14. });
  15. });
  16. });
The highlighted section is what I want. I already know that this won't work, because I've tried it then re-read the description and realized that ".toggle" binds to the click function. That's fine, but I need the same functionality on a ".keydown" event. Any suggestions?