Jump to content


Hidden DIV


4 replies to this topic

#1 _*Creative Insanity_*

  • Guests

Posted 27 March 2007 - 04:10 PM

I done a search and didn't get the result I wanted. Didn't know what to search for really.

Ok, I have a hidden div that shows with a mouse over.
Is there a way to have the hidden layer show over another div without pushing the div down?
I wanted it to just float over top and effect none of the other divs.

Possible?

Ta muchly

#2 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 27 March 2007 - 10:42 PM

In a <script> section:
function toggleWindow() {
	document.getElementById("popup").style.display = (document.getElementById("popup").style.display == 'none') ? "block" : "none";
}

In the <BODY> section:
<div id="popup" style="background-color: #000; border: 1px dotted #ffff00; width: 85%; height: 350px; margin: 100px auto 0 50px; position: absolute; display: none; text-align: center; "><br /><br /><br /><br /><a href="#" onclick="toggleWindow()">Close Window</a></div>
<div style="background-color: #ccc; border: 1px dotted #000; width: 75%; height: 200px; margin: 50px auto 0 auto; "></div>
<div style="background-color: #ccc; border: 1px dotted #000; width: 75%; height: 200px; margin: 25px auto 0 auto; text-align: center; "><br /><br /><br /><br /><a href="#" onclick="toggleWindow()">Open Window</a></div>
<div style="background-color: #ccc; border: 1px dotted #000; width: 75%; height: 200px; margin: 25px auto 0 auto; "></div>

There's what I came up with. Hope that helps. :)

Edited by SpatialVisionary, 27 March 2007 - 10:46 PM.


#3 _*Creative Insanity_*

  • Guests

Posted 27 March 2007 - 10:54 PM

Thanks heaps SV.. will give it a crack.

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 29 March 2007 - 09:02 PM

That's a lot of stuff i don't feel like reading through. If you have the div and mouseover working properly aside from the fact that it moves stuff around. Just give the div an absolute position via CSS (i.e. style="position:absolute;"). Relative might even work, then you definately won't have to worry about setting it's actual position.

#5 Stewie

    Young Padawan

  • Validating
  • Pip
  • 14 posts

Posted 30 March 2007 - 10:52 PM

Like rc69 said absolute will allow the divs to overlap and not interfere with each other, absolute means css doesnt care about anything else, relative means it looks around it for other div, fixed means it looks at the browser window and the browser and something like that.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users