Blogger UserBlogger TutorialsMake your Blog Easy to Navigate with Keyboard Arrows

Make your Blog Easy to Navigate with Keyboard Arrows

One must have feature in blogs is the Next and Previous buttons at bottom of each post. Using Keyboard Arrows to do those functions of Next and Previous Posts within your blog would definitely be more useful to your blog.

In this blogger tutorial, we will learn how to implement the cool feature in our blogger blogs. You will be simply adding a widget in your blog to achieve this keyboard navigation feature.

Adding the Widget

  • 1. Go to “Layout” tab on the blog you want to implement this feature.
  • 2. “Add a Gadget” in your sidebar or footer area.
  • 3. Select the HTML/JavaScript gadget and paste the below code in the gadget.

Code for the Widget

 <script type='text/javascript'>
document.onkeyup = function(event)
{
if (document.activeElement.nodeName == 'TEXTAREA' || document.activeElement.nodeName == 'INPUT') return;
event = event || window.event;
switch(event.keyCode)
{
case 37:
var newerLink = document.getElementById('Blog1_blog-pager-newer-link');
if(newerLink !=null) window.location.href = newerLink.href;
break;
case 39:
var olderLink = document.getElementById('Blog1_blog-pager-older-link');
if(olderLink!=null) window.location.href = olderLink.href;
}
};
</script> 

Leave the title empty so that nothing appears on your front-end. The widget can simply be deleted in case you change your mind and want to remove the feature.

Are you using this in your blog? Do let us know in the comments below.

Tagged under:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>