jQuery用户界面标签:如何在不重装切换到一个(阿贾克斯)标签? [英] jQuery UI Tabs: How to switch to a (ajax) tab without reloading it?

查看:92
本文介绍了jQuery用户界面标签:如何在不重装切换到一个(阿贾克斯)标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这篇关于jQuery用户界面标签:如何在不重装切换到一个(阿贾克斯)标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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