Rajasekar
Rajasekar

Reputation: 18948

How to set the custom image at the start based on user click of the jQuery Galleria slideshow

I have set up jQuery galleria successfully. But what I want is to set up the first image loaded on the galleria dynamically. i.e., consider there is five links as one,two,three,four,five. When the user clicks the link three, the galleria will appear and display the gallery with THIRD image at first.

Upvotes: 0

Views: 188

Answers (1)

Eric G
Eric G

Reputation: 3517

The documentation for galleria says it accepts a show option that "defines what image index to show at first." You may find some other useful initialization options there: http://github.com/aino/galleria/blob/master/docs/options.rst

var firstImage = 2;//May or may not be zero-based index. Try it out.
$('#galleria').galleria({
    show: firstImage,
    //whatever other options...
});

What you didn't mention is how you intend to pass which index you want. If you put it in the URL, here's a doc that tells you how to get it using jQuery: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html

If the javascript is contained in the page and not it's own file, you could easily enough use php to write in the appropriate value as well.

Upvotes: 1

Related Questions