jquery - Disable keydown during animation -


I use the following code to enable the user to show or hide a photo description (# photoonefo) and a menu:

  $ (document). Unwind ('keypress'); $ {Document} .keydown (function (event) {switch (event.keyCode) {case 38: if ($ ('# photoinfo'). ("Open")) {closeInfo ();} else if ($ ( '.slidetable'). ("Open")) {closeSlide2 (); openInfo ();} and {openInfo ();} breaks; case 40: if ($ ('slidetable'). (".open" } {CloseSlide ();} and if ($ ('# photoinfo'). ("Open") {closeInfo (); OpenSlide ();} and {openSlide ();} break;} It seems wrong is;});  

It seems that the only problem is that if two arrows are pressed at the same time, or one after the other, both divs are open, after the first animation starts, I basically I am looking for a way to ignore keydown function, and once it is over, the keydown is rebalancing the function. I'm a jquery newbie, so maybe this is not the best way to do this. What is the easiest way to prevent other functions from firing during animation?

Thanks

Before you set a boolean (animating) on ​​fire After animation and after completing it, just say it on the top of the keyring set to false

  if (is animate) {event.preventDefault (); return false; }  

I do not remember the syntax to call the function at the end of the animation but this is in jQuery's document


Comments