Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide image upon mouseover

Status
Not open for further replies.

markjson

Programmer
Nov 10, 2010
9
GB
Hi,

What I want to do:

I have a img tag, which I want to fade out upon mouseover, showing the text underneath it, and then fade in upon mouseout behaviour.

The following is the code:

Code:
<div id="box1" class="rollover1" style="background:#d61c5c;">
       <img src="uploads/images/box1.jpg" width="147" height="147" alt="About Us" class="fade"/>
       <a href="#"><div id="rollover_text"><strong>ABOUT US</strong><br /><br />
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod <br /><br /><p align="right"><u>More</u></p>
       </div></a>
</div>

With the following jQuery code:
Code:
$(document).ready(function () {
	$("img.fade").hover(function(){
		$(this).fadeTo("slow", 0);
		},function(){
			$(this).fadeTo("slow", 1);
	});
});

What is actually happening is this:
Upon mouseover, it does successfully fades out the image, but it doesn't show the text underneath it, only the background colour of the div.

What I think might be happening is that the fadeout behaviour is simply decreasing image opacity, instead of removing it altogether. But even if this is what it's doing, it should still show the text in the background div.

What am I doing wrong, and how can I achieve the desired results?

Thanks in advance!

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top