What additional content does the div have that make it neccessary not to use the fading of the image itself?
Main Topics
Browse All TopicsIn javascript i would like to enhance the standard image rollover script by adding another div on top of any image i might rollover that will fade out or in upon mouse rollover.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
jasonsbytes: sounds good, if you have time to write the rest that would be awesome/ i'm sleep deprived as well. Also i just found out today that this functionality needs to work on opera as well?..i am unfamiliar with tha plafform so am looking into it today.
hey Zvonko:, i'll try to explain the sequence. It is a standard rollover situation, but i guess there needs to be a "flash" of acknowledgement when the mouse rolls over the image. Would like it to be a separate function just so that i can use it in a variety of ways. say if i want a fade of another image or system over the standard rollover...something like that, i hope i'm explaining okay.
ok, let me make sure I'm clear on what you need.
You want a <div> </div> container that you can position and size however you want over the top of existing images and by default it is transparent (invisible).
-- when the mouse goes over it, it should fade into a solid background
-- when the mouse goes out, it should fade back to being transparent
is that correct?
jasonsbytes:
Yep, it is an extra div tag that can float anywhere.(is invisible by default)-correct
-when the mouse moves over any rollover situation this extra div would appear fully opaque, then fade down(so on a timer-not just on mouseout)--i.e if you sat on the image you rolled over there would be an instaneous div that appears then(while you are still sitting on the image) the new div that appeared would fade out.
if it's easier to run through an array of images we could do that? like maybe a list of png's that get's activated on rollover-so i can control the transparency>- only if you think this is an easier solution, of course it's more memory though.
wow, this was a pain... but there it is and should work in all browsers:
<html>
<head>
<style type="text/css">
#floatyFady
{
/* adjust the top, left, width, height to fit over your image(s) */
position: absolute;
top: 20px;
left: 20px;
width: 300px;
height: 200px;
background-color: #ccc;
border: solid 1px #000;
/* Safari & Mozilla */
opacity: 0;
/* IE */
filter: alpha(opacity=0);
}
</style>
<script type="text/javascript">
// rate of fade out
var fadeDelay = 120;
function popFade()
{
var obj = document.getElementById('f
// pop to fully opaque if the mouse isn't over it now
obj.style.opacity = 1; // others
obj.style.filter = 'alpha(opacity=100)'; // IE
fadeOpacity();
}
function fadeOpacity()
{
var obj = document.getElementById('f
var curO = obj.style.opacity;
var newO;
if (curO > 0)
{
newO = (curO * 10) - 1
obj.style.opacity = newO / 10; // others
obj.style.filter = 'alpha(opacity=' + newO * 10 + ')'; // IE
setTimeout("fadeOpacity()"
}
}
</script>
</head>
<body>
<div id="floatyFady" onMouseOver="popFade();">
</div>
</body>
</html>
Business Accounts
Answer for Membership
by: jasonsbytesPosted on 2007-06-19 at 21:03:07ID: 19321954
I would write 2 functions:
ivFade').s tyle.alpha = i;
fadeIn and fadeOut
Call one onMouseOver and the other onMouseOut.
All the function needs to do is loop for x number of times and for each iteration, it should adjust the alpha style of the css class or id that applies to the overlaying div's.
Something like:
for (i=0; i < 100; i++)
{
document.getElementById('d
}
and reverse the loop to face out.
I can write it for you, but don't have time right now... If you still need help tomorrow, let me know and hopefully I'll have more time...
it's bed time now... :)