Danny Nimmo
Danny Nimmo

Reputation: 684

Help loading images into Galleria dynamically

I am building a site with the gallery as the main feature, and I need the gallery to have "categories". I am going to load in the images via AJAX but at the moment just getting the Galleria gallery to load in different images is proving challenging. My code is as follows:

function swap_gallery() {
    var new_slideshow = [
        { image: '../images/slideshow/architecture_3.jpg' },
        { image: '../images/slideshow/report_1.jpg' }
    ];
    Galleria.get(0).load({
        data_source: new_slideshow
    });
}

When I run this function I get this error in Firebug:

Error: Load failed: no data found.

For the life of me I can't work this one out.

Upvotes: 3

Views: 4639

Answers (4)

user1508976
user1508976

Reputation: 171

Galleria.get(0).load(new_slideshow);

which is, in fact, the same as mhenrys answer

Upvotes: 0

mhenry1384
mhenry1384

Reputation: 7688

This works for me in Galleria 1.2.9.

Galleria.get(0).load([
        { image: '/foo/bar/image1.jpg' },
        { image: 'image2.jpg' },
        { image: 'bacon/eggs/image3.jpg' }
    ]);

Upvotes: 1

defvol
defvol

Reputation: 15480

Just push the new values as you would do for an array.

Galleria.get(0).push({image: '../images/slideshow/architecture_3.jpg'});

Galleria API #Manipulation http://galleria.aino.se/docs/1.2/api/methods/

Upvotes: 2

Try dataSource: new_slideshow instead of data_source: new_slideshow

Upvotes: 0

Related Questions