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 provide 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.
Copyright 2013 LayerVault Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.