Highslide: Opening a webpage instead of expanding an image

840 Views Asked by At

Is there any way to simply open a web page when an image in the gallery is clicked instead of expanding the image on the page? I'm sure that the solution - if there is one - would probably require changing the following code:

onclick="return hs.expand(this, inPageOptions )
2

There are 2 best solutions below

5
On

Just a guess but try

onclick = "window.open('http://www.yoururl.com')";
0
On

See this demo gallery: http://jsfiddle.net/roadrash/KtDpz/

Use hs.Expander.prototype.custom to set the URL you want to open when clicking each image in the gallery:

onclick="return hs.expand(this, inPageOptions, {url: 'http://roadrash.no/'})"


Replace the hs.Expander.prototype.onImageClick code with this:

// go to url when clicking the image
hs.Expander.prototype.onImageClick = function() {
    if (this.custom) {
        window.open(this.custom.url);
    }
    return false;
};