Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other JavaScript hover fade. Re: JavaScript hover fade.

#46782
Chris Coyier
Keymaster

Using jQuery you can do fade in and outs super easily. I’m just learning, but it would go something like this:

Code:
$(.button).each(function(){ // everything with class=”button”
$(this).click(function(){ // when clicked
$(this).fadeOut(); //fades out
)};
)};

You could have something behind it that it fades into, which when clicked or hovered or something, would fade back in the original. I am FAR from an expert on this, but thems the basics. You’ll have to include jQuery as a script on your page before you call this (from within another script tag).