One popup div, multiple documents

D

delraydog

I'm having a problem trying to use a single DIV object for a popup menu
when I'm using embedded IFrames. All the IFrames have the same parent
document but I can't make the popup appear inside of each IFrame unless
I appendChild the popup DIV to each individual IFrame document body.
Should I be able to show the popup without having to reparent the popup
object? Are there any tricks to be aware of?

Cliff
 
V

VK

I'm having a problem trying to use a single DIV object for a popup menu
when I'm using embedded IFrames. All the IFrames have the same parent
document but I can't make the popup appear inside of each IFrame unless
I appendChild the popup DIV to each individual IFrame document body.
Should I be able to show the popup without having to reparent the popup
object? Are there any tricks to be aware of?

IFRAME is a separate window-type object with its own document in it. So
any alement (like DIV) can be inside of IFRAME in only one way: *by
being inside* - means being a part of IFRAME document DOM structure.

If by "inside" you mean "atop of a particular iframe" then you can
achieve it by setting myDIV.style.zIndex higher than IFRAME and
locating your DIV atom of the IFRAME.
 
D

delraydog

Here's the function I'm using to try and get the vertical y position of
an anchor element within an IFrame, that is within my document:

MyUtils.findPosY=function(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}

I'm calling the function with the Anchor Element and no matter what
I've tried I always get a Y position of 1, not the actual position
within the browser window. Any further ideas?

Cliff.
 
T

Thomas 'PointedEars' Lahn

MyUtils.findPosY=function(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)

Instead:

while (obj)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}

I'm calling the function with the Anchor Element and no matter what
I've tried I always get a Y position of 1, not the actual position
within the browser window. Any further ideas?

You need to test `obj', because you assign `obj.offsetParent' at the
end of each loop.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top