luke
luke

Reputation: 362

Cache content loaded via AJAX in Fancybox

Due to performance optimization I want to prevent users from reload fancyboxes they already loaded once. This is my code:

        $(document).ready(function() {
            $(".fancybox-effects").fancybox({
                type       : 'ajax',
                wrapCSS    : 'fancybox-custom'
            });
        });

Adding this:

            $.ajaxSetup({ cache: true });

to the document.ready function doesn't help. Any ideas?

Upvotes: 0

Views: 2184

Answers (1)

JFK
JFK

Reputation: 41143

You could try

$(document).ready(function() {
    $(".fancybox-effects").fancybox({
        type       : 'ajax',
        ajax       : { cache: true },
        wrapCSS    : 'fancybox-custom'
    });
});

Upvotes: 3

Related Questions