animation - jQuery: Animate on change of .innerHTML or .text -


I translate my site with jQuery, dynamically by translating it like this:

  & lt; Span id = "mySpan" & gt; Some English & lt; / Span & gt; $ ('# MySpan') Html ("Something else in Spanish");  

This works great, but due to changes in the length of the text, it is a difficult transition, the new text just appears and the original element is immediately changing the shape.

Is there an easy way to reduce / ease the transition during change of text? Well like fading and / or resizing?

I know that is possible with hidden elements, but because I have lots of text, I do not want to load it if not.

Thank you!

OK, if your duration element has a parent, for example For:

  & lt; Div class = "parent" & gt; & Lt; Span id = "mySpan" & gt; Some English & lt; / Span & gt; & Lt; / Div & gt;  

You can do this:

  $ ('# mySpan'). Chetan ({'opacity': 0}, 400, function () {$ (this) .html ('some in Spanish'). Chetan ({'opacity': 1}, 400);});  

Actually, you change the ambiguity of the child to span , 400 is the transition time MS After that action, you do a callback function which returns span to html instead of the desired text, while it has opacity: 0 , And then you do the animation on the back at opacity: 1 .


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -