只需点击一个按钮,我就会尝试fadeOut一张图片,当它淡出时,我会改变图片的来源。然后我使用fadeIn来显示新的图像。这在Chrome和firefox中运行良好。但是,在ie10中,图像淡出和淡入,然后新图像出现。我找不到解决它的办法。我试着延长fadeOut的持续时间,fadeIn。我试过使用setTimeout函数。我尝试过使用promise().done()函数。我试过使用Jquery UI的隐藏/显示和滑动效果,同样的问题也出现了。似乎什么都不起作用。我真的很感谢任何人的帮助。谢谢
me.$el.find('#printable-detail-static-imageRight').fadeOut('fast', function(){
me.$el.find('#printable-detail-static-imageRight').attr('src', me.options.samplePrints[k+i]);
me.disableNext();
});
me.$el.find('#printable-detail-static-imageRight').fadeIn('slow')发布于 2013-07-04 09:43:06
我非常确定您需要将.fadeIn方法放在回调函数中,以便它受到回调函数的影响。实际上,我会向.attr方法添加另一个回调函数,以确保只有在更改了src之后,它才会淡入。
Here's是我写的一个jsFiddle,用来说明我的意思。
发布于 2013-07-04 16:48:09
我在一台mac上,但是这段代码能在ie中运行吗?jsFiddle
.html
<div id="content">Promises</div>
<button id="click">start animation</button>.js
$("#click").on("click", function () {
$('#content').fadeOut({
duration: 1000,
// run when the animation is complete
complete: function () {
$("#content").append($("<div>").addClass("fakeimg"));
},
// run when the animation is complete +
//it's promise is resolved
done: function () {
$('#content').fadeIn(1000);
}
});
});发布于 2013-07-06 01:09:59
这是可行的:
me.$el.find('#printable-detail-static-imageRight').animate({
opacity:0
}, {
duration: 700,
step: function(now, fx){
if(fx.pos > 0.40 && fx.pos < 0.5){
$(this).attr('src', me.options.samplePrints[k+i]);
me.disableNext();
}
if (fx.pos ==1) {
$(this).animate({
opacity:1
}, 200);
}
}
});https://stackoverflow.com/questions/17460198
复制相似问题