在Fancybox中缓存通过AJAX加载的内容 [英] Cache content loaded via AJAX in Fancybox

查看:67
本文介绍了在Fancybox中缓存通过AJAX加载的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于性能优化,我想防止用户重新加载他们已经加载过一次的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'
            });
        });

添加此内容:

            $.ajaxSetup({ cache: true });

到document.ready函数没有帮助.有什么想法吗?

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

推荐答案

您可以尝试

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

这篇关于在Fancybox中缓存通过AJAX加载的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆