I'm building a dynamic gallery with galleria. The idea is that you'd click on a product category and the associated photos are loaded into the gallery. Clicking a category would first remove all the images currently sitting in the gallery and then load the ones. I can successfully load new photos in dynamically (below), but I can't figure out how to get rid of all the current ones first.
$("#category1").click(function(){
var category1photos = [
{ image: 'images/products/photo1.jpg' },
{ image: 'images/products/photo2.jpg' }
];
Galleria.get(0).push(category1photos);
});
Is there a particular reason why you don't change the datasource and rerun the galleria?
Then you can easily change the images:
var data = [
{ image: "/path/to/myimage1.jpg" },
{ image: "/path/to/myimage2.jpg" },
];
var gallery = this;
gallery.load(data);
Data being any source (JSON, data-attribute, etc)