どんな助けでも大歓迎です...
カラー写真が白黒からフェードアウトする効果を作成しようとしています。フェードインは機能しますが、最初に白黒のものをフェードアウトします。その後、ホバリングすると元のグラフィックに戻りますが、現在はまったく行われていません。
以下のコードは、上記のセクションとは別に完全に機能します...
//Loop through the images and print them to the page
for (var i=0; i < totalBoxes; i++){
$.ajax({
url: "random.php?no=",
cache: false,
success: function(html) {
// following line I originally suggested, but let's make it better...
//$('#bg').append(html).fadeIn('slow');
// also note the fine difference between append and appendTo.
var $d = $(html).hide().appendTo('#bg').fadeIn('slow');
$('img', $d).hover(function() {
var largePath = $(this).attr("rel");
$(this).fadeOut("slow", function() {
$(this).attr({ src: largePath }).fadeIn("slow");
});
});
}
});
}