Given this html code
<div id="div1">
Some Text
</div>
<div id="div2">
</div>
Is it possible to animate "Some Text" from div1 to div2? I would like to move just the text rather than the whole element.
Given this html code
<div id="div1">
Some Text
</div>
<div id="div2">
</div>
Is it possible to animate "Some Text" from div1 to div2? I would like to move just the text rather than the whole element.
You can't animate text directly, but you can make it seem that you are animating it. You could hide the destination
div
and then show it using an animation.http://jsfiddle.net/s9gEk/
I'd suggest putting the text in a sub element (maybe a span or something), using jQuery to get the position (offset/coordinates), then set that span to position absolute and the position with the previously mentioned offset, then you can do the animation, with a callback of replacing the div 2's content with the animated content and put position back to normal.
that's a little tricky, you could grab the text, pop it into a absolute positioned div with a z-index so it floats over the page, then animate that div to the target area & insert the text into the target div. Here is a rough example off the top of my head. I've tested it and it works well.
Sure, though you'll need to create a wrapper to do the animation...
Here's a demo: http://jsfiddle.net/TuuvF/1/
Here's the play by play explanation...
You can try something like this.
Demo
You can't really "animate" it... you can take the text and put it into the other div..
Best solution would be to animate the element, maybe animate it then swap the content, then reset the original div?