sbrpsls
Posts: 1
Joined: Fri Jan 27, 2012 8:15 pm

Jump to specific image/caption within slideshow group

How can I create a link to a specific image/caption within a slideshow group?

For example, I have a slideshow with 10 images. How do I create a link (on my html page) to image/caption 9 while retaining the next/previous controls of the entire slideshow group?
User avatar
EarlyOut
Posts: 1705
Joined: Sun Nov 11, 2007 9:22 pm
Location: Sector R
Contact: Website

Re: Jump to specific image/caption within slideshow group

First, each image in the gallery needs to have a unique ID. So, the href might look like this:

Code: Select all

<a id='image1' href='slides/bears1.jpg' class='highslide' onclick='return hs.expand(this)'>
Then you need to set up a couple of listeners in your highslide.config.js:

Code: Select all

hs.addEventListener(window, "load", function() {
var autoload = /[?&]autoload=([^&#]*)/.exec(window.location.href);
if (autoload) document.getElementById(autoload[1]).onclick();
});
hs.addEventListener(document, "ready", function() {
var autoload = /[?&]autoload=([^&#]*)/.exec(window.location.href);
if (autoload) document.getElementById(autoload[1]).focus();
});
Then, the link to, say, image6 would look like:

Code: Select all

http://example.com/index.html?autoload=image6

Return to “Highslide JS Usage”