サイトのサムネイル画像がロード時に 1 つずつフェードインします。サムネイルの後にフッターを表示する方法を知りたいのですが、すぐには表示されず、画像がフェードインすると押し下げられます。
最初の調査の後、関数に何らかのコールバックを追加する必要があることに気付いたので、アラートを配置しましたが、画像がフェードインした後に何らかの理由でポップアップしません。
<script type="text/javascript">
$(window).load(function() {
var images = $('figure');
var imageCount = images.length;
var count = 0;
var fadeImages = function(image, callback) {
$(image).fadeIn(170, function() {
// Increase the count.
count++;
if (images[count]) {
// Pass the callback to the recursively called function.
fadeImages(images[count], callback);
}
});
// Make sure that we're only calling the callback once the images have all loaded.
if (typeof callback === 'function' && count === imageCount) {
callback.call(this); // brings the scope to the callback
}
};
fadeImages(images[0], function() {
alert('Load footer'); // your callback here
});
});
</script>
ここの私のウェブサイトで私が何を意味するかを見るでしょう。
私の主な質問は次のとおりです。
1) 画像がロードされた後にコールバック関数を実行するにはどうすればよいですか?
2)画像がフェードインした後にフッターを表示するために何を書くべきか、誰かが私を正しい方向に向けることができますか?
どんな助けでも大歓迎です!