I've been playing with a div I have that changes on a user action. I want to have it fade out, change the node value and then fadeIn.
我一直在玩一个div,它改变了用户的动作。我想让它淡出,改变节点值然后是fadeIn。
No matter what I try I always see the value change as the element is fading out. Can anyone help?
无论我尝试什么,我总是看到随着元素的消失,价值的变化。谁能帮忙吗?
calculator_result.fadeOut();
calculator_result.css("color", "#fff").html("€" + vRelief + ".00");
calculator_result.fadeIn();
This is the code I'm using now but I tried it a few different ways! A delay might work but surely these a cleaner way?
这是我现在使用的代码,但是我尝试了几种不同的方法!拖延可能会奏效,但这肯定是一种更干净的方式吗?
Cheers, Denis
欢呼,丹尼斯
1 个解决方案
#1
11
Have the change and the fade in occur in the callback for fadeOut. When you do it in the callback, the code won't run until after the effect is complete.
在fadeOut的回调中出现更改和淡入。当您在回调中执行此操作时,代码在效果完成之后才会运行。
calculator_result.fadeOut( 'normal', function() {
$(this).css("color", "#fff").html("€" + vRelief + ".00" )
.fadeIn();
});
#1
11
Have the change and the fade in occur in the callback for fadeOut. When you do it in the callback, the code won't run until after the effect is complete.
在fadeOut的回调中出现更改和淡入。当您在回调中执行此操作时,代码在效果完成之后才会运行。
calculator_result.fadeOut( 'normal', function() {
$(this).css("color", "#fff").html("€" + vRelief + ".00" )
.fadeIn();
});