Fade a selection of text to another selection of text using CSS3 transitions, but invoked via JavaScript.
$('h1').fadeTo("New Title");
You can also give it a few options:
$('h2').fadeTo("New Subheading", {
fadeInLength: 1000,
fadeOutLength: 2000,
fadeInEasing: 'ease-in',
fadeOutEasing: 'ease-out'
});
Or event a callback:
$('h2').fadeTo("New Subheading", function () {
alert("We're done!");
});
Just include jquery.text.fadeto.js
as a script tag on the page. Bonus points for incorporating it into your asset pipeline.
jquery.text.fadeto.js was originally developed for LayerVault by Kelly Sutton.
You can see more projects from LayerVault in the LayerVault Cosmos.