Hi, I need help!
Im updating a div with groups of images using jquery ajax.
I'm also using the Galleria plugin to display these images. My problem is this: on the first set of images loaded galleria works fine, but if i try to load differnt images galleria does not load again and the image just get placed in the div!

this is my jquery ajax that loads the images in

// whenever a link with category class is clicked
$('a.project').click(function(e) {
    // first stop the link to go anywhere
    e.preventDefault();
    // you can get the text of the link by converting the clicked object to string
    // you something like 'http://mysite/categories/1'
    // there might be other methods to read the link value
    var linkText = new String(this);
    // the value after the last / is the category ID
    var projectvalue = linkText.substring(linkText.lastIndexOf('/') + 1);
    // send the category ID to the showprojects.php script using jquery ajax post method
    // send along a category ID
    // on success insert the returned text into the shownews div
    if($('#shownews').data('galleria')){$('#shownews').data('galleria').destroy()} //destroy, if allready running
$.post('../inc/showprojects.php', {project: projectvalue}, function(data) {
    $('#shownews').html(data);
    Galleria.run('#shownews');
});


});

Can anyone help me out with this?

Thanks

Assuming your a.project content is inside your #shownews, you should use $('a.project').on('click', function(e){...}); instead of the click function, since it will only work for the content you load the first time, and is not binded to dynamically created objects.

Hey thanks for the reply, but its still doing the same thing!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.