0

First of all, I am just grapic designer not webdeveloper so please be patient.

I am creating my portfolio website and I want to switch between sites with my projects using narrow keys on keyboard.

To do this I used this js:

codepen.io/SoqllooS/pen/vNNGwv

And example looks like this :

http://problem.bplaced.net/keyboard_...st_01_003.html

I need that script to be unfailing and reliable. Now I have a problem that this isn't workin on Firefox and Internet Explorer.

Please tell me how to fix this.

Thanks!

Soqlloos
  • 3
  • 1
  • Welcome to StackOverFlow. rather than posting links, you have to accompany it with your code segment. since you are new to SOF, please read the help guide on how to ask a good question. – Nomesh DeSilva Sep 11 '15 at 03:15

1 Answers1

0

I've changed your script to make it work:

http://codepen.io/anon/pen/VvvKxP

$(document).ready(function() {
  var nextPage = $("#next_page_link");
  var prevPage = $("#previous_page_link");
  if (typeof nextPage !== 'undefined' && typeof prevPage !== 'undefined') {
    nextUrl = nextPage.attr("href");
    prevUrl = prevPage.attr("href");
    $(document).bind("keydown", function(e) {
      var j = e.which;
      if (j === 39) {
        window.location = nextUrl;
      } else if (j === 37) {
        window.location = prevUrl;          
      }
    });
  }
});

Hope this helps.

gkempkens
  • 440
  • 4
  • 12