jQuery can obviously fadeIn/fadeOut text easily. But what if you want to change the text from one thing to another? Can this happen with a transition?
Example:
<div id='container'>Hello</div>
Can one change the text Hello to World but have it change with a transition (like a fade or some effect) instead of changing instantly?
one way I can think of to do this is to have child elements with text and show only one to begin with, then fade the other ones in one after another.
have a look here: http://jsfiddle.net/VU4CQ/
If you'll use hide/show or fadeIn/fadeOut you may encounter some "jumping" effect, because it changes CSS display property. I would suggest using animate with opacity.
Like this:
I would suggest you use basic slider jQuery plugin. Very lightweight (6k) and does what you want and has couple of customization options without all the clutter of most slider plugins. I use it all the time and it's great.
You can use callbacks, like this:
You can give it a try here, or because of how the queue works in this particular case, like this:
This executes the
.text()
call when the.fadeOut()
is complete, just before fading in again.Using array lookups for text and color change, transition speed, and mouseenter, mouseleave events on this menu like this:
Here is a live example.
It works well.