Perform function in attr() callback?

前端 未结 2 1412
甜味超标
甜味超标 2021-01-06 10:24

Not sure if I am doing this correctly or not.

Here is my .js:

var currentIMG;
$( \'.leftMenuProductButton\' ).hover(function () {

              


        
2条回答
  •  花落未央
    2021-01-06 10:46

    $("#swapImg").css("opacity", 0).attr("src", productImages[swapIMG])
             .on("load",function(){ //fires each time when image loaded
                $(this).fadeIn("slow");
             });
    

    This will also properly.

提交回复
热议问题