&Follow SJoin OnSugar

Follow Us

Blog from Any Website

Add the OnSugar Bookmark link to your browser bar and blog something from any website! Learn more!

Need a Hand?

Be sure to check out the Official OnSugar Help for more info!

Navigate Using Left and Right Arrow Keys

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.

Posted by sabs on May 28, 2009 at 2:39PM | Permalink | 27 Comments

posted by
5/28/09

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!


posted by
5/28/09

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.


posted by
5/28/09

Sabs, this is awesome!


posted by
5/28/09

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?


posted by
5/28/09

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


posted by
5/29/09

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


posted by
6/06/09

Thats helpful thanks


posted by
6/22/09

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


posted by
6/22/09

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


posted by
6/24/09

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

Sujja
---------

FTP Client


posted by
6/29/09

elow juzt view my profile tnx fanz


posted by
7/01/09

Nice feature thanks


posted by
7/30/09

hay


posted by
7/31/09

how to change the date and the time?


posted by
8/04/09

How to delete my account? :/


posted by
8/04/09

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


posted by
8/07/09

Thanks


posted by
8/08/09

how to delete my account ?


posted by
8/09/09

I wanna delete my account. Help please?


posted by
8/09/09

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


posted by
8/14/09

how can i get a picture


posted by
8/14/09

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


posted by
3/06/10

I love it when people share their tips and tricks (instead of making us wonder "how did they do that?").


posted by
4/26/10

I agree Aisling1331, it takes the guessing out of doing a simple technology task. The tips was so clear, no assistance was needed.


posted by
7/29/10

Hello,

I'm new here, it's my first time here. It's my pleasure to post here in this site. Thanks!


posted by
8/30/11

I'm new here, it's my first time here. www.ledpxgd.com


posted by
9/03/11

I'm new here, it's my first time here www.golfclubs80.com



Post A Comment

To post comments, please log in or register.