次の提案を使用してスピナーを開発しました。
http://blog.oio.de/2010/11/08/how-to-create-a-loading-animation-spinner-using-jquery/
スピナーは、何もせずに、非表示にせずにそのまま実行すると機能します。
しかし、スピナーをコードのブックエンドとして関数に埋め込んでいます。最初に示し、最後に終了します。しかし、遅延が1秒を超えるほど十分なデータをロードしても、表示されません。
コードは次のとおりです。
function SortListByDistance(SortReferenceLatitude, SortReferenceLongitude)
{
$("#SpinnerControl").show();
$(".RetailerSearchSectionLine").each(function()
{
var SortLocationLatitude = $(".RetailLocationLatitude", $(this)).text();
var SortLocationLongitude = $(".RetailLocationLongitude", $(this)).text();
var DistanceFromReferenceLocation = CalculateDistance(SortReferenceLatitude, SortReferenceLongitude, SortLocationLatitude, SortLocationLongitude);
$(this).data("DistanceFromReferenceLocation", DistanceFromReferenceLocation);
});
var TransferArray = $("#RetailerSearchSectionBody ul li").toArray().sort(function(a, b)
{
var distance1 = $(a).data("DistanceFromReferenceLocation");
var distance2 = $(b).data("DistanceFromReferenceLocation");
return (distance1 - distance2);
});
$("#RetailerSearchSectionBody ul").append(TransferArray);
$("#RetailerSearchSectionBody").scrollTop(0);
$("#SpinnerControl").hide();
}
ショーがレンダリングされない理由を誰か教えてもらえますか? 助けてくれてありがとう。