Skip to main content
deleted 35 characters in body; edited tags; edited title
Source Link

Arrow key events with jQuery not working in anything other than FF!Firefox

I have created a portfolio site and whilst browsing the images, I want users to be able to navigate using the arrow keys. I have the following code which works fine in FFFirefox but not Chrome, Safari or IE.

 $(document).keypress(function (evt) {   if (evt.keyCode == 39) {   evt.preventDefault();   $.scrollTo('+=564px', 800, { axis:'x' });   } else if (evt.keyCode == 37) {   evt.preventDefault();   $.scrollTo('-=564px', 800, { axis:'x' });   } }); 

I have the scrollToscrollTo plugin installed and working as well as a valid jQuery file so it's not an issue with these. Can anyine tell me why this might not function in other browsers?

Live example here.

Help always appreciated!

Arrow key events with jQuery not working in anything other than FF!

I have created a portfolio site and whilst browsing the images, I want users to be able to navigate using the arrow keys. I have the following code which works fine in FF but not Chrome, Safari or IE.

 $(document).keypress(function (evt) {   if (evt.keyCode == 39) {   evt.preventDefault();   $.scrollTo('+=564px', 800, { axis:'x' });   } else if (evt.keyCode == 37) {   evt.preventDefault();   $.scrollTo('-=564px', 800, { axis:'x' });   } }); 

I have the scrollTo plugin installed and working as well as a valid jQuery file so it's not an issue with these. Can anyine tell me why this might not function in other browsers?

Live example here

Help always appreciated!

Arrow key events with jQuery not working in anything other than Firefox

I have created a portfolio site and whilst browsing the images, I want users to be able to navigate using the arrow keys. I have the following code which works fine in Firefox but not Chrome, Safari or IE.

$(document).keypress(function (evt) { if (evt.keyCode == 39) { evt.preventDefault(); $.scrollTo('+=564px', 800, { axis:'x' }); } else if (evt.keyCode == 37) { evt.preventDefault(); $.scrollTo('-=564px', 800, { axis:'x' }); } }); 

I have the scrollTo plugin installed and working as well as a valid jQuery file so it's not an issue with these. Can anyine tell me why this might not function in other browsers?

Live example here.

Help always appreciated!

Source Link
DanC
  • 1.3k
  • 4
  • 24
  • 42

Arrow key events with jQuery not working in anything other than FF!

I have created a portfolio site and whilst browsing the images, I want users to be able to navigate using the arrow keys. I have the following code which works fine in FF but not Chrome, Safari or IE.

 $(document).keypress(function (evt) { if (evt.keyCode == 39) { evt.preventDefault(); $.scrollTo('+=564px', 800, { axis:'x' }); } else if (evt.keyCode == 37) { evt.preventDefault(); $.scrollTo('-=564px', 800, { axis:'x' }); } }); 

I have the scrollTo plugin installed and working as well as a valid jQuery file so it's not an issue with these. Can anyine tell me why this might not function in other browsers?

Live example here

Help always appreciated!