Skip to content

Instantly share code, notes, and snippets.

@hdragomir
Created November 30, 2010 12:32
Show Gist options
  • Save hdragomir/721612 to your computer and use it in GitHub Desktop.
Save hdragomir/721612 to your computer and use it in GitHub Desktop.
A simple plugin to cross fade an element's children on rollover.
(function($){
$.fn.kidFader = function(){
return $(this).each(function(){
$(this).hover(function(){
$(this)
.children('.hover').stop(1,1).hide().fadeIn('fast')
.end()
.children('.normal').stop(1,1).fadeOut('fast');
}, function(){
$(this)
.children('.hover').stop(1,1).fadeOut('fast')
.end()
.children('.normal').stop(1,1).fadeIn('fast');
});
})
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment