Enable thumbnail via ajax

Asked

Viewed 30 times

1

I am loading an image gallery via AJAX with the fancybox so I need to also put the thumbnails in this gallery as I should proceed?

Return of my JSON:

[{"title":"caption 1.... aa","href":"553e2ec2a7be4.jpg"},{"title":"caption 1.","href":"553f7d3c4bed5.jpg"},{"title":"caption 1.","href":"553f7d4924889.jpg"},{"title":"caption 1.","href":"553f7d5770577.jpg"},{title":"caption 1.","href":"553f7d6459659.jpg"}]

My JS

$('#maisAlbuns').on('click', function(event){
event.preventDefault();
$.getJSON( "/fotos/3", function( data ) {
    $.fancybox(data,[
        {
            helpers: {
                thumbs: {
                    width: 40,
                    height: 40,
                    source: function (current) {
                        return $(current.element).data('href');
                    }
                }
            }
        }]);
});

});

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.