jQuery用户界面标签:如何在不重装切换到一个(阿贾克斯)标签?标签、重装、用户界面、切换到

2023-09-11 01:05:47 作者:花街、卖笑的

在缓存仍处于禁用状态(即缓存:假),我怎么能prevent再次加载远程内容的标签?从本质上讲,我想选择标签而不是负荷吧。

When the caching remains disabled (i.e. cache: false), how can I prevent the tab from loading the remote content again? Essentially, I would like to select a tab but not load it.

推荐答案

事实证明,你可以通过设置'cache.tabs数据中的每个选项卡的锚元素控制每个标签的高速缓存。

It turns out that you can control the caching of each tab by setting the 'cache.tabs' data in each tab's anchor element.

我张贴的答案在另一篇文章: JQuery用户界面选项卡缓存,但我只是转贴了code在这里。

I posted the answer in another post: JQuery UI Tabs caching, but I'll just repost the code here.

// disable cache by default
$("#tabs").tabs({
    cache: false,
});

再经过标签内容加载的第一次,你可以启用缓存该选项卡。我只是把它放在 $(文件)。就绪的缓存网页:

$(document).ready(function () {
    // cache content for the current tab
    var currentTabIndex = $("#tabs").tabs('option', 'selected');
    var currentTabAnchor = $("#tabs").data('tabs').anchors[currentTabIndex];
    $(currentTabAnchor).data('cache.tabs', true)
});