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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fade image on mouse hover

Status
Not open for further replies.

jamesmay

Technical User
Jun 1, 2004
41
GB
Hi, can anyone tell me how to fade an image if the mouse overs over it?

Regards,

James.
 
Hi, i found this script which does what i want but back to front... can anyone tell me how to make the image fade when i have hovered over it?

kind thanks.


<script language="JavaScript">
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=30
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
</script>


this goes in the img tag...

style="filter:alpha(opacity=100);-moz-opacity:0.3" onMouseover="high(this)" onMouseout="low(this)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top