Jquery 如何制作替换的图像fadeIn()

Jquery 如何制作替换的图像fadeIn(),jquery,asp.net,Jquery,Asp.net,我一直在玩一个脚本,它将图像从低质量版本替换为高质量版本,替换工作正常,但是,我需要替换的图像慢慢淡入,而不是像现在这样立即替换 //For each of the images in the class $(".image-to-be-reloaded").each(function (i, classReturn) { var image = classReturn.firstChild; //Gets the image for that element //Get

我一直在玩一个脚本,它将图像从低质量版本替换为高质量版本,替换工作正常,但是,我需要替换的图像慢慢淡入,而不是像现在这样立即替换

//For each of the images in the class
$(".image-to-be-reloaded").each(function (i, classReturn) {

    var image = classReturn.firstChild; //Gets the image for that element


    //Get the original source
    var originalSource = image.src;

    //Replaces the preview within the query string to use the high quality version.
    var finishedSource = //My replace method goes here

    image.src = finishedSource; //Update the image src


    $(classReturn).replaceWith(image).fadeIn(10000);

});

我正在使用的fadeIn没有被执行,尽管前面的文本肯定是,我在这里做错了什么?

我已经找到了一种方法来实现我在使用下面的代码段时尝试做的事情

$(classReturn).replaceWith(function () {
    return $(image).hide().fadeIn(4000);
});