且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JQuery UI 选项卡 - “正在加载..."信息

更新时间:2023-12-05 17:45:52

如果您对选项卡使用缓存,那么此解决方案可能更适合,它仅在内容尚未打开时显示 ajax 加载这一页.

If you're using caching for your tabs, then this solution is propably a better fit, it only shows the ajax loading if the content isn't already on the page.

$(".tabs").tabs({
   cache:true,
   load: function (e, ui) {
     $(ui.panel).find(".tab-loading").remove();
   },
   select: function (e, ui) {
     var $panel = $(ui.panel);

     if ($panel.is(":empty")) {
         $panel.append("<div class='tab-loading'>Loading...</div>")
     }
    }
 })