views:

104

answers:

4

I want to hover on an image, and have a div with text in it to fade in. Simple.

Sidenote: I want it to be style-able by CSS. (Kind of a given.) Also, I tried using some examples but I am in a hurry so please and thankyou.

+1  A: 

If your using jQuery, Something like:

$('element').hover(function()
{
    $('div').animate({ 'opacity': 1 });
}); 
Jud Stephenson
If you could, will you provide the html too, if its not to much. Thanks :)
Darlene Conner
+1  A: 

Try this: http://jsfiddle.net/2WYtS/

malckier
A: 

You can also use the fadeIn() and fadeOut() methods. Link

Dienekes
A: 

Try this:

<div class="hover">
    <img src="http://www.google.com/intl/en_ALL/images/srpr/logo1w.png" alt="google" />
</div>
<div class="fade" style="display:none">
    This text will Fade In and Out.
</div>​

$(document).ready(function()
{    
    $("div.hover").hover(
      function () {
        $("div.fade").fadeIn('slow');
      }, 
      function () {
        $("div.fade").fadeOut('slow');
      }
    );
});​

Sample code here

By the way, how do you want it to be CSS stylable?

Lee Sy En
I need to be able to style the div but thats easy.
Darlene Conner