DHTML Script needed - image rollover, transparency, scroll/fade effects

Anyone know of any examples of this out there, possibly some scripts that already exist that will achieve the following things...?

I have an image on the page.  When the mouse rolls over this image, I want a box to scroll down underneath the image (or fade in underneath the image).  This box needs to have a background color with some transparency.  In the box I will have an image that includes only some text with a transparent background (it has to be an image to use a specific font).

Something like this:
___________________
|                               |
|          IMAGE 1         |
|                               |
---------------------------

When you roll over IMAGE 1, you get this:

___________________
|                               |
|          IMAGE 1         |
|                               |
---------------------------
___________________
|                               |
|          LAYER            |
|                               |
|                               |
|                               |
|                               |
|                               |
---------------------------

Where LAYER scrolls down from IMAGE 1 (or simply fades in).  LAYER has the background color with something like 75% transparency.  LAYER's contents include a gif that has text and a transparent background.

thanks for the help.










econy1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NetGrooveCommented:
Is this what you ask for:

<html>
<head>
<script>
function show(theImg, divId){
  theDiv = document.getElementById(divId);
  theDiv.style.display='block';
  theDiv.style.top = theImg.offsetTop+theImg.height;
  theDiv.style.left = theImg.offsetLeft;
}
function hide(divId){
  document.getElementById(divId).style.display='none';
}
</script>
</head>
<body>
<div id="box" style="position:absolute; display:none; filter:alpha(opacity=75);-moz-opacity: 75;" >
<img src="image2.gif" >
</div>
<br><br><br>
<center>
<img src="image1.gif" onMouseOver="show(this, 'box')" onMouseOut="hide('box')">
</center>
</body>
</html>


0
econy1Author Commented:
This will not work.  This element is going to be in the middle of a page with other images and design all around it.  I'm fairly certain that I need to use layers for this.  For example, I put your suggestion in a table and as you will see, the result did not work:

<html>
<head>
<script>
function show(theImg, divId){
  theDiv = document.getElementById(divId);
  theDiv.style.display='block';
  theDiv.style.top = theImg.offsetTop+theImg.height;
  theDiv.style.left = theImg.offsetLeft;
}
function hide(divId){
  document.getElementById(divId).style.display='none';
}
</script>
</head>
<body>
<div id="box" style="position:absolute; display:none; filter:alpha(opacity=75);-moz-opacity: 75;" >
<img src="image2.gif" >
</div>
<br><br><br>
<center>
<table border="1">
<tr>
      <td><img src="image1.gif" width="100" height="50" onMouseOver="show(this, 'box')" onMouseOut="hide('box')"></td>
</tr>
<tr>
      <td>Here is some text.</td>
</tr>
</table>
</center>
</body>
</html>



I probably need something similar to how a dhtml dropdown navigation menu works (something like what is used here --  http://support.gateway.com).  Only I will only have one element, the dropdown needs to slide down from the image or fade down, and the dropdown needs to contain an image over its semi-transparent background.

0
Dean OBrienCommented:
econy, try this out, obviously you would call the function from your mouse over instead of a click!

<html>
<head>
<script language="javascript">
<!--//
var d1,d2,steps,wAmount,hAmount,lAmount,tAmount,oAmount

var slidein = "1"
var divOpacity = 100
var newTop = null
var currTop = null
var direction = null

function slide() {
     document.getElementById('copy').style.visibility='visible';
     currTop = parseInt(document.getElementById('copy').style.top)

     if (document.all) {
          newTop = document.body.scrollTop
     } else {
          newTop = window.pageYOffset
     }
     
      if (parseInt(document.getElementById('copy').style.top) == newTop) {
          direction = '+';
      }else{
           direction ='-';
       }
     slideNow()
}
function slideNow() {

     if (direction == "-") //sliding up
     {
          if (parseInt(document.getElementById('copy').style.top) != newTop) {
                    document.getElementById('copy').style.top = eval ("parseInt(document.getElementById('copy').style.top) " + direction + " 1")
                    setTimeout("slideNow()", 1)
     }          
       }else{ //sliding down
          if (parseInt(document.getElementById('copy').style.top) != 280) {
               document.getElementById('copy').style.top = eval ("parseInt(document.getElementById('copy').style.top) " + direction + " 1")
                    setTimeout("slideNow()", 1)
          }
        }
}

function setOpacity(objectId,objectOpacity) {
     if (document.all){
          document.all(objectId).filters.alpha.opacity = objectOpacity
     } else if (!document.all && document.getElementById) {          
          document.getElementById(objectId).style.MozOpacity = objectOpacity/100
     }
}

function fadeDiv(oAmount) {
inc=oAmount
     divOpacity = divOpacity - oAmount
     if (divOpacity > 0 && divOpacity < 100) {
          setOpacity("copy",divOpacity)
          setTimeout("fadeDiv(inc)",1)
     }
}

function test(){

     if(slidein == "1")
     {
       slide();
       fadeDiv(0.3);
       slidein = "0";
     }
     else
     {
       slide();
       fadeDiv(-0.3);
       slidein = "1";  
     }
}


//-->
</script>
    </head>
<body>
<a href="javascript:test()"Click this!</a>
<br>

<div id="copy" style="position:absolute; top:280; left:362; color:red;filter:alpha(opacity=100); font-size:30px; z-index:4">
<table style="color:red;filter:alpha(opacity=100); font-size:30px;">
<tr><td>Text 1</td></tr>
<tr><td>Text 2</td></tr>
<tr><td>Text 3</td></tr>
<tr><td><img src="mail.jpg" width="150px" height ="150px"></td></tr>
</table>
</div>
</body>
</html>

Easynow
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dean OBrienCommented:
Sorry, theres a '>' missing from the anchor tag.

Change to this.

<a href="javascript:test()">Click this!</a>

Easynow
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.