Har*_*y F 7 javascript jquery timeout fade
我有一个问题,我想淡出图像,然后将图像移动到一个空<li>容器.然而,图像不会褪色,而是看起来像是使用了移动来覆盖淡入淡出html().
以下是我正在尝试做的事情.有没有办法可以迫使移动等待淡入淡出完成?
// Fade out image to be replaced
mosaic_box.find('img').fadeTo(7000, 0.0)
// Then move the image
$('.mosaic_list li:empty', obj)
.random(1)
.html(mosaic_box.find('img')
.addClass('mosaic_last_img')
);
Run Code Online (Sandbox Code Playgroud)
在fadeTo函数的回调中移动:
mosaic_box.find('img').fadeTo(7000, 0.0, function() {
$('.mosaic_list li:empty', obj)
.random(1)
.html(mosaic_box.find('img').addClass('mosaic_last_img'));
});
Run Code Online (Sandbox Code Playgroud)