在缓存仍处于禁用状态(即缓存:假
),我怎么能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)
});