PDA

View Full Version : Overlapping Content script Location of Div



pala
08-14-2007, 01:14 PM
1) Script Title: Drop down/ Overlapping Content script

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex5/overlapcontent.htm

3) Describe problem: When clicked, I would like the DIV to appear in the middle of the page..
I would be grateful for any help.

pala
08-15-2007, 08:21 AM
Any help with this?

pala
08-15-2007, 09:09 AM
Ok I kind of made a hack job here that works for me:

Replace the javascript code with this from "function overlay(curobj, subobjstr, opt_position)"



function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"

var IpopTop = (document.body.clientHeight - document.getElementById(subobjstr).offsetHeight) / 2;
var IpopLeft = (document.body.clientWidth - document.getElementById(subobjstr).offsetWidth) / 2;

var xpos=document.getElementById(subobjstr).style.left=IpopLeft + document.body.scrollLeft;
var ypos=document.getElementById(subobjstr).style.top=IpopTop + document.body.scrollTop;



subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"