2012-02-18 34 views
0

我使用了流水遊戲教程來製作一些ajax選項卡式內容,但它沒有在內容加載之間使用任何種類的加載指示。我怎樣才能把它添加到這個腳本中? http://pastebin.com/PebcJspn如何添加...加載到我的選項卡中的ajax腳本

<script> 
    $(function() { 

     $(".feed-tabs ul").tabs("div.feeds > div", { 

      effect: 'fade', 

      onBeforeClick: function(event, i) { 

       // get the pane to be opened 
       var pane = this.getPanes().eq(i); 

       // only load once. remove the if (...){ } clause if you want the page to be loaded every time 
       if (pane.is(":empty")) { 

        // load it with a page specified in the tab's href attribute 
        pane.load(this.getTabs().eq(i).attr("href")); 
       } 

      } 
     }); 

    }); 
</script> 
+0

在帖子中添加了代碼,沒有理由轉到另一個網站獲取該小塊代碼。 – epascarello 2012-02-18 14:06:14

+0

你想在哪裏載入信息? – epascarello 2012-02-18 14:07:22

+0

哦哎呀..​​.我希望它出現在div.feeds的頂部。我想將它放在該部分中心的某個位置,以便將內容加載到該部分。 – 2012-02-18 14:10:37

回答

1

你可以嘗試的加載GIF添加元素之前調用該方法​​當​​插入HTML結果將被刪除。

<script> 
    $(function() { 
    $(".feed-tabs ul").tabs("div.feeds > div", { 
     effect: 'fade', 
     onBeforeClick: function(event, i) { 
     // get the pane to be opened 
     var pane = this.getPanes().eq(i); 

     // only load once. remove the if (...){ } clause if you want the page to be  loaded every time 
     if (pane.is(":empty")) { 
      //add this 
      pane.append("<img src='http://mentalized.net/activity-indicators/indicators/ilcu/roller.gif'/>") 
      // load it with a page specified in the tab's href attribute 
      pane.load(this.getTabs().eq(i).attr("href")); 
     } 
     } 
    }); 
    }); 
</script> 
+0

完美!謝謝! – 2012-02-18 14:32:34

相關問題