问题:如果用户单击选项卡A,然后再单击选项卡B,然后再单击选项卡A,则选项卡A的内容将加载两次.
是否可以缓存JQuery UI选项卡的内容?
解决方法
$(".selector").tabs({ beforeLoad: function(event,ui) { // if the target panel is empty,return true return ui.panel.html() == ""; } });
beforeLoad( event,ui )
Triggered when a remote tab is about to be loaded,after the
beforeActivate event. Can be canceled to prevent the tab panel from
loading content; though the panel will still be activated. This event
is triggered just before the Ajax request is made,so modifications
can be made to ui.jqXHR and ui.ajaxSettings.Note: Although ui.ajaxSettings is provided and can be modified,some of these settings have already been processed by jQuery. For example,prefilters have been applied,data has been processed,and type has been determined. The beforeLoad event occurs at the same time,and therefore has the same restrictions,as the beforeSend callback from jQuery.ajax().
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。