Does attr substitute src have fadeIn effect at the same time?

the target of the substitute

<img class="" id="productview_icon" src="">

the object of initiating event

<img class="change-display" data-icon_src="xxx" src="">

event

e.preventDefault();
var icon_src = e.currentTarget.dataset.icon_src;

$("-sharpproductview_icon").fadeIn().attr("src", icon_src);

I found that I couldn"t achieve the fadeIn effect.
he just src it, but it doesn"t have any effect.
how to achieve this function?

Mar.23,2021

document: http://www.w3school.com.cn/jq. setting transition time


you can only use two images, one fadeIn, one fadeOut


use css to write two class to control, and then use js to switch class, to add fadeIn/fadeOut effect, or write animation. Use animate to control


Picture FadeIn Test

$(document).ready(function () {
        var img = $("-sharpmy-img");
        img.fadeOut("slow",function () {
            img.attr("src",img.data("src"));
            img.fadeIn(4000);
        });
    });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b375dd-410cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b375dd-410cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?