Jump to content

Overlapping Content?


rockinaway

Recommended Posts

You need to combine CSS and JavaScript (this is call DHTML). You will need to create a div and set the style to what ever you want; but be sure to set the display to "none" and the position to "absolute". Then set the z-index to something like; I don't know, I always use "1000" of more. You may also have to play around with the margins of the overlapping div. Then set you JavaScript like this:

 

<script language="javascript">
function showDIV(myDIV)
{
document.getElementById(myDIV).style.display='block';
}
function hideDIV(myDIV)
{
document.getElementById(myDIV).style.display='none';
}
</script>

<div id="overlap1">
<a href="javascript:hideDIV('overlap1')">Close Me</a>
</div>

<br><br>

<a href="javascript:showDIV('overlap1')">Open Overlap Content</a>

Link to comment
https://forums.phpfreaks.com/topic/80520-overlapping-content/#findComment-408263
Share on other sites

If you want it to overlap; you will have to set the CSS style position to "absolute" and set the z-index higher then the rest of your elements/tags.

 

This Will Overlap:

 

<script language="javascript">
function showDIV(myDIV)
{
document.getElementById(myDIV).style.display='block';
}
function hideDIV(myDIV)
{
document.getElementById(myDIV).style.display='none';
}
</script>

<div id="overlap1" style="position:absolute;z-index:1000;width:300px;height:300px;display:none;background:white;border:solid 1px black">
<a href="javascript:hideDIV('overlap1')">Close Me</a>
</div>

Content Here...........................................................................

<br><br>

<a href="javascript:showDIV('overlap1')">Open Overlap Content</a>

 

You may have to play with the margins a bit.

 

The original code will just show/hide content; I just assumed you knew how to use CSS to style the DIV tag - sorry about that.

Link to comment
https://forums.phpfreaks.com/topic/80520-overlapping-content/#findComment-409277
Share on other sites

  • 2 weeks later...

I mean the positioning of the div is underneath the button.. so like

 

[button1][button2][button3] 
                  [DIV appear here when button 3 clicked]

 

At the moment, eventhough button3 is clicked, the DIV appears below button1, at the start of the page.. how can I move it so that it appears below 3?

Link to comment
https://forums.phpfreaks.com/topic/80520-overlapping-content/#findComment-416739
Share on other sites

<input type="button" value="Button 1">
<input type="button" value="Button 2">
<input type="button" value="Button 3">
<script language="javascript">
function showDIV(myDIV)
{
document.getElementById(myDIV).style.display='block';
}
function hideDIV(myDIV)
{
document.getElementById(myDIV).style.display='none';
}
</script>

<div id="overlap1" style="position:absolute;z-index:1000;width:300px;height:300px;display:none;background:white;border:solid 1px black">
<a href="javascript:hideDIV('overlap1')">Close Me</a>
</div>

<br><br>

<a href="javascript:showDIV('overlap1')">Open Overlap Content</a>

Link to comment
https://forums.phpfreaks.com/topic/80520-overlapping-content/#findComment-416975
Share on other sites

<input type="button" value="Button 1">
<input type="button" value="Button 2">
<input type="button" value="Button 3">
<script language="javascript">
function showDIV(myDIV)
{
document.getElementById(myDIV).style.display='block';
}
function hideDIV(myDIV)
{
document.getElementById(myDIV).style.display='none';
}
</script>

<div id="overlap1" style="position:absolute;z-index:1000;width:300px;height:300px;display:none;background:white;border:solid 1px black;overflow:hidden">
<a href="javascript:hideDIV('overlap1')">Close Me</a>
<table width=100% height=90% border=1 align=left valign=top>
<td width=100% height=90% border=1 align=left valign=top>
Table Content
</td>
</table>
</div>

<br><br>

<a href="javascript:showDIV('overlap1')">Open Over</a>

Link to comment
https://forums.phpfreaks.com/topic/80520-overlapping-content/#findComment-417277
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.