Cache content loaded via AJAX in Fancybox

风流意气都作罢 提交于 2019-12-11 20:30:09

问题


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:


You could try

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


来源:https://stackoverflow.com/questions/17620815/cache-content-loaded-via-ajax-in-fancybox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!