0

特定のdiv内の私のサイトの画像が読み込まれているときはいつでも、Jqueryを使用して読み込み中のgifを添付する方法はありますか?グローバル関数にしたいと思います。これを行うために私が理解できる唯一の方法は、jqueryを使用して特定のリンクを呼び出してからロードするloading.gifことですが、それは私の状況では機能しません…</ p>

インデックスHTML:

<div id="content">
  <div class="projectThumb">
  <img src="/img/aeffect_button_static.gif" name="aeffect" />
  <p class="title">title</p>
  </div>
</div>
<div id="popupContainer"></div>

HTMLと呼ばれる:

<div class="projectPopup" id="aeffect">
  <a class="close">Close &times;</a>
  <img src="/img/aeffect_popup.jpg" width="500" height="729" alt="" />

  <p class="description">Description</p>
</div>

JQuery:

$(document).ready(function() {
    //Find & Open
    $(".projectThumb").click(function(){
            $("#backgroundPopup").show();
            htmlName = $(this).find("img").attr("name");
            $("#popupContainer").load("/content/" + htmlName + ".html", null, function(){
            //Set Variables
            var container = $(".projectPopup")
            var popupWidth = container.find("img:first").width()+10;
            var popupHeight = container.find("img:first").height()+60;
            var windowWidth = document.documentElement.clientWidth;
            var windowHeight = document.documentElement.clientHeight;

            //Set popup dimensions
            container.css("width" , popupWidth);
            container.css("height" , popupHeight);

            //Set popup CSS
            container.css({"position": "absolute", "background": "#000", "top": "5%", "left": (windowWidth / 2) - (popupWidth / 2) + "px", "z-index": "2" });
            });
});
    //Close property
    $("a.close").live("click", function(){
            $("#popupContainer").empty();
            $("#backgroundPopup").hide();
    });
});

前もって感謝します

4

1 に答える 1

0

プロパティをフックアップしbeforeSendてハンドラーをアタッチし、読み込みインジケーターを表示できます。詳細については、こちらをご覧ください

于 2009-09-11T15:51:56.140 に答える