Cache content loaded via AJAX in Fancybox

2019-09-02 19:38发布

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?

1条回答
萌系小妹纸
2楼-- · 2019-09-02 20:20

You could try

$(document).ready(function() {
    $(".fancybox-effects").fancybox({
        type       : 'ajax',
        ajax       : { cache: true },
        wrapCSS    : 'fancybox-custom'
    });
});
查看更多
登录 后发表回答