hgnl96 hgnl96 - 1 year ago 107
Javascript Question

Shuffle.js function after Ajax call

I use this library: http://vestride.github.io/Shuffle/, works good, but the the problem I have now is, I have a load more button, for loading more images.

It is made with Ajax, but when I call the function again after the Ajax call, the grid is not updated:


My shuffleGrid function:

shuffleGrid = function(){
var $grid = $('#block .content');

itemSelector: '.views-row'

Answer Source

Problem solved by do this:

    $('#block .content .views-row:not(.shuffle-item)').each(function() {
        var $newRow = $(this);

        $('#block .content').append($newRow);
        $('#block .content').shuffle('appended', $newRow);