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

问题描述:

全部,

我正在使用 Jquery UI 嵌套选项卡.我只是想知道是否有任何方法可以在选项卡加载时在选项卡文本旁边显示 AJAX Spinner 图像.我不想将标签文本更改为正在加载...".考虑到当多个标签同时加载或一个接一个加载时,微调图像应该显示在每个加载标签旁边..

I am using Jquery UI nested tabs. I was just wondering if there is any way to display an AJAX Spinner image next to the tab text, while the tab is loading. I do not want to change the tab text to "Loading..". Consider that when multiple tabs are loading at the same time or one after the other, the spinner image should be displayed next to each loading tab..

有什么建议吗?

谢谢

如果您对选项卡使用缓存,那么此解决方案可能更适合,它仅在内容尚未打开时显示 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>")
     }
    }
 })