[英]Moving a div and changing it's text in jQuery
I'm having a problem with moving a div and changing it's text while doing a fadeOut/fadeIn. 我在执行fadeOut / fadeIn时移动div并更改其文本时遇到问题。 I have tried numerous options, even with creating a new div but nothing seems to work.
我尝试了许多选项,即使创建了一个新的div,也似乎无济于事。 append/appendTo won't work and for the past 5h I'm completely stuck here.
append / appendTo将无法正常工作,过去5个小时我完全被困在这里。 See the full fiddle at http://jsfiddle.net/2DgNX/10/
参见http://jsfiddle.net/2DgNX/10/上的完整提琴
I'm also quite new to jQuery and might be enterpreting on how to solve this way too easily. 我对jQuery还很陌生,可能对如何解决这种方法太容易了。 Basicly, the text "Go to yellow" should move to yellow.
基本上,“转到黄色”文本应变为黄色。 Either with just moving the existing #normal-text or by using the .detach function and creating a new element.
只需移动现有的#normal-text或使用.detach函数并创建一个新元素即可。 .detach would be the prefered solution as I will probably be calling the text in the future scenarios.
.detach将是首选的解决方案,因为在将来的场景中我可能会称呼该文本。
$("#normal-text").fadeOut(1000, function () {
//APPEND TO YELLOW
$("#hi").append($('#yellow'), function () {
//FADEIN
$("#text").text("Hi!").fadeIn(1000);
});
});
I don't know what you want exactly but this might be the code to do it: http://jsfiddle.net/2DgNX/12/ 我不知道您到底想要什么,但这可能是执行此操作的代码: http : //jsfiddle.net/2DgNX/12/
I think you got the animate-syntax wrong. 我认为您的动画语法错误。 There is no
没有
{
duration: 700,
queue: false
}
Its only 700
as secpnd argument. 它只有
700
作为第二个参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.