jQuery menu onkey press - open menu
I created a jQuery script which would you require to press numpad0 and it would open up a menu. Pasting "jQuery('.panel_toggle').trigger('click');" works and brings up the menu yet having it in a fuction doesn't work. Also I must note that the console registers me pressing numpad0 so that works fine to.
- jQuery(document).ready(function()
- {
- jQuery(".panel_toggle").toggle(function()
- {
- jQuery('#panel_stats').stop().animate({'height':'415px'},500)
- },function()
- {
- jQuery('#panel_stats').stop().animate({'height':'0px'},500)
- });
-
- jQuery('body, html').live('keypress', openMenu)
- });
- function openMenu(e)
- {
- console.log(e.keyCode)
- if(e.keyCode == '96')
- {
- e.preventDefault()
- jQuery('.panel_toggle').trigger('click');
- }
- }
Anyhow I'm very confused.
Thank you for the help.