How to integrate jquery code into my blog
-
Hi All,
I believe this is my first post here, so my apologies if this is in the wrong place.
I just have what I think should be an easy question for all of you. I came across the following jquery code that’ll allow visitors to my site to navigate back and forth between posts using the left and right arrow keys on their keyboard. My site is set up for single post pages. Could someone please tell me what to do with this code to make it work? Thanks in advance!
$(document).ready(function () { $(document).keydown(function(e) { var url = false; if (e.which == 37) { // Left arrow key code url = $('.prev a').attr('href'); } else if (e.which == 39) { // Right arrow key code url = $('.next a').attr('href'); } if (url) { window.location = url; } }); });
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to integrate jquery code into my blog’ is closed to new replies.