Skip to content

Instantly share code, notes, and snippets.

@shameerc
Created October 1, 2011 09:50
Show Gist options
  • Save shameerc/1255819 to your computer and use it in GitHub Desktop.
Save shameerc/1255819 to your computer and use it in GitHub Desktop.
cross browser event listener for keyboard events
// cross browser event listener for keyboard events
if(window.addEventListener){
window.addEventListener('keypress',moveBar,false);
if($.browser.webkit){
window.addEventListener('keydown',moveBar,false);
}
}
else if(window.attachEvent){
window.attachEvent('keypress',moveBar,false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment