Updates, Tips, and Things We Like

Navigate Using Left and Right Arrow Keys

Thu, 05/28/2009 - 2:39PM by sabs 23 Comments - 2,810 Views

You can now use your keyboard’s left and right arrow keys to browse a gallery! Just click on any photo in your gallery (like this one), and navigate to the next one with your keyboard. It’s a new feature that is automatically built in to each gallery.

However, the fun doesn’t stop there. With a little bit of eyelash-batting, I was able to get our dev team to share the secret. With a few simple theme hacks, you can now build left/right arrow navigation into your blog (you can see it in action at the Daily Sabs). To add the feature, just place the following bits of code to the "Page" template of your theme.

Directly above the </body> tag add this code:

<script type="text/javascript">
onsugarInitSlideKeys();
</script>

And then add links for previous and next by using the following bits of code (you can change the bit that says "Go Back" and "Go Forward" and can place these links anywhere below the <body> tag and above the script code):

<a id='slide_previous' href="?page={$page_previous_page}">Go Back</a>

<a id='slide_next' href="?page={$page_next_page}">Go Forward</a>

Save your theme, and you should be set!

Remember, this is just a fun hack and it make take some tweaks to get it working right. If you need a hand, drop us a line at help@onsugar.com.


1

You guys are AMAZING I defintiely want to add this to my site as I send individual posts to those in PR that I have posted about their product. It would be nice to have that next post or previous post so that they can see other goodies without hoping that they will remember to click the top of the page to go back to the beginning!

Thu, 05/28/2009 - 3:23pm

2

this particular code should only work on "pages" (like actual navigation pages) - i don't think it will work on post navigation as is. you need to change the part that says {$page_next_page} and {$page_previous_page} to {$post_next} and {$post_previous} --- you will also need to put the navigation links in your "Post" template, but be sure to leave the script in the "Page" template. hope that makes sense!

also - your theme, actually has "Previous" and "next" built into the bottom of the posts. that's called in your theme template with the {$post_navigation} line of code.

Thu, 05/28/2009 - 3:39pm

3

Sabs, this is awesome!

Thu, 05/28/2009 - 3:47pm

4

I noticed this feature last week and it has been driving me batty ever since. I surf on a small screen and I used to use my arrow keys to scroll the window -- it took me a little bit to figure out why it wasn't working anymore! Are there plans to give people the option to turn the feature off if they so choose?

Thu, 05/28/2009 - 4:00pm

5

hi lauriegilbert - as of now there is not a way to disable this feature. i'll let you know if we create one. thanks!

Thu, 05/28/2009 - 4:46pm

6

Hi Sabs, thanks so much for getting back to me!

Fri, 05/29/2009 - 10:47am

7

Thats helpful thanks

Sat, 06/06/2009 - 5:06am

8

Hey!

I am a newbie in your site.And you know from the very first visit to your started loving it. The guys are amazing. Thanks!

Kvi
------

FTP Software

Mon, 06/22/2009 - 12:11am

9

Hey!!I'm new to this site and I just want you guys to check me out at Live Life O

Mon, 06/22/2009 - 4:26am

10

I'm seriously going to have to post more here. This site rocks!

Sujja
---------

FTP Client

Wed, 06/24/2009 - 12:03am

11

elow juzt view my profile tnx fanz

Mon, 06/29/2009 - 6:36am

12

Nice feature thanks

Wed, 07/01/2009 - 1:24pm

13

hay

Thu, 07/30/2009 - 9:50am

14

how to change the date and the time?

Fri, 07/31/2009 - 11:03pm

15

How to delete my account? :/

Tue, 08/04/2009 - 7:59am

16

for help regarding other topics please contact help@onsugar.com - thanks!

Tue, 08/04/2009 - 8:20am

17

Thanks

Fri, 08/07/2009 - 6:57pm

18

how to delete my account ?

Sat, 08/08/2009 - 12:36am

19

I wanna delete my account. Help please?

Sun, 08/09/2009 - 3:02am

20

for help please contact help@onsugar.com - please be sure to provide as much info as possible. thank you!

Sun, 08/09/2009 - 4:38pm

21

how can i get a picture

Fri, 08/14/2009 - 8:17am

22

this post is for left/right arrow navigation. if you need assistance, please contact help@onsugar.com with your question. be sure to add as much info as possible. thanks.

Fri, 08/14/2009 - 8:40am


Post A Comment

To post comments, please log in or register.