任何帮助,将不胜感激...
我正在尝试创建从黑白淡入淡出的彩色照片的效果。作品中的淡入淡出,但它首先将黑色和白色淡出,这是我不想要的……我喜欢它看起来好像颜色正在通过。然后,一旦它悬停在它上面,它应该恢复到我目前根本没有做的原始图形。
除了我上面提到的部分之外,下面的代码完美地工作......
//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");
});
});
}
});
}