0
$(document).ready(function(){
$('#load-extmsg-1').click(function(){
$("#stars").empty().html('<img src="/images/ajax-loader2.gif" id="loadingpic" style="width:25px;height:25px;border:0px;margin-left:48px;margin-top:0px;" />');
$.post('starproc.asp?picid=<%=picid%>&starrating=1', function(data){
$("#loadingpic").remove();
$("#stars").append(data);
})
});
});
JQuery的工作,但如何讓加載GIF停留1秒鐘,然後淡出所附的數據失效?延遲加載GIF和附加數據
以下是經過一些試驗和錯誤後的代碼。
$(document).ready(function(){
$('#load-extmsg-1').click(function(){
$("#stars").empty().html('<img src="/images/ajax-loader2.gif" id="loadingpic" style="width:25px;height:25px;border:0px;margin-left:48px;margin-top:0px;" />').fadeIn(200).delay(300);
$.post('starproc.asp?picid=<%=picid%>&starrating=1', function(data){
$("#loadingpic").fadeOut(300).delay(200);
$("#stars").append(data);
})
});
});
你可以添加到現有的代碼?不知道我應該堅持或取代現有的代碼。謝謝 – Patriotec
@Patriotec:爲你添加 – genesis
沒有。在提交時,gif加載然後快速消失,然後div淡出,然後數據被追加。 – Patriotec