簡體   English   中英

jQuery顯示加載圖像,直到頁面加載到div中

[英]jquery show loading image until page loaded in div

每當頁面加載到div中時,我都試圖顯示加載圖像,但看不到加載圖像。

我嘗試了這個:

<img src="images/ajax-loader.gif" id="loading">

jQuery的:

$('#content').fadeOut('fast', function(){
    $('#loading').show();
    $('#content').load("about.php", function(){
        $('#content').fadeIn('slow');
        $('#loading').hide();
    });
});

將您的<img src="images/ajax-loader.gif" id="loading">保留在#content div之外。

在about.php之后,您的jQuery中缺少引號。

這是修改后的jQuery:

$('#content').fadeOut('fast', function(){
    $('#loading').show();
    $('#content').load("about.php", function(){
         $('#content').fadeIn('slow');
         $('#loading').hide();
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM