views:

16

answers:

2

I'm very new to javascript & jQuery, and can't work out how to do this. The source code can be found here. Thanks for reading.

+1  A: 

The API isn't very well documented here, but when you run .galleria(), it returns the gallery object, so you can hang on to a reference to it, like this:

var gallery = $('#galleria').galleria();

Then you can use it later to move like you want:

gallery.next(); //move next
gallery.prev(); //move back

Here you're just accessing the next and prev functions defined on the gallery object returned.

Nick Craver
A: 

I'm re-answering this since the plugin just had a new revision where the accepted answer wont work anymore.

The best way is to use the extend method to attach events to external elements. See the demo available here: http://galleria.aino.se/media/galleria/demos/classic-03.html

You can also fetch the Galleria instance anywhere, like Nick wrote, using:

var gallery = Galleria.get(0); // fetches the first instance

gallery.next();
gallery.prev();

The API has been updated here: http://github.com/aino/galleria/blob/master/docs/

Have a look at public-methods, events and static-methods.

David