Solved

Div contents to appear or disappear gradually

Posted on 2008-06-25
2
1,791 Views
Last Modified: 2010-04-21
Dear all,

I have the scrip below that shows or hides the divMain contents if you put the mouse over some text.
Now the contents appear or disappear abruptly, and I would like them to show or hide gradually,  with certain opacity. How can it be done??

Also, I have to place the mouse over the "***Show or hide divMain***" text in order to make the script work.
Could it be possible to place the mouse over the div (divMain) to make it show or hide???

Thanks a million in advance!!!!
<head>
   <script type="text/javascript" language="JavaScript"><!--
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//--></script>
  </head>
  <body>
 
 
<a onmouseover="ReverseContentDisplay('divMain'); return true;"
   href="javascript:ReverseContentDisplay('divMain')">
***Show or hide divMain***
</a>
 
<br><br>
<div id="divMain">
I have a picture and some text here in divMain <br><img src="picture.jpg">
</div>
  </body>

Open in new window

0
Comment
Question by:Dada44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 21865898
Hi Dada44,
You can apply that on image object only based on the opacity settings that you required.
Here is the sample article show how you can do that:
http://www.dynamicdrive.com/dynamicindex4/highlightgrad.htm

You need to set a timer to repeat reduce the image's opacity gradually until the final effect that you needed.
You can apply the code according based on your current situation. Hope that helps.
0
 

Author Closing Comment

by:Dada44
ID: 31470487
Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS for Popup in ASP.NET 4 40
CSS question 16 59
problems with widget background image 9 31
Drag & Drop Error 5 24
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question