Cool component idea. :)
One work around for the form components appearing over floating divs
is to get all of the select components on a page and check to see if
any of them reside in the same area as the floating div and make them
disappear. Here is some code to a dhtml menu system that does just
that. I'm not exactly sure how all of the positioning detection works
but maybe this will help.
Mike
// Calculates the absolute page x coordinate of any element
function pageX(element)
{
var x = 0;
do
{
if (element.style.position == 'absolute')
{
return x + element.offsetLeft;
}
else
{
x += element.offsetLeft;
if (element.offsetParent)
if (element.offsetParent.tagName == 'TABLE')
if (parseInt(element.offsetParent.border) > 0)
{
x += 1;
}
}
}
while ((element = element.offsetParent));
return x;
}
// Calculates the absolute page y coordinate of any element
function pageY(element)
{
var y = 0;
do
{
if (element.style.position == 'absolute')
{
return y + element.offsetTop;
}
else
{
y += element.offsetTop;
if (element.offsetParent)
if (element.offsetParent.tagName == 'TABLE')
if (parseInt(element.offsetParent.border) > 0)
{
y += 1;
}
}
}
while ((element = element.offsetParent));
return y;
}
// Hides HTML select elements that are overlapping the given menu group
function hideSelectElements(group)
{
if (document.getElementsByTagName)
{
var arrElements = document.getElementsByTagName('select');
if (hideSelectElems)
for (var i = 0; i < arrElements.length; i++)
if (objectsOverlapping(document.getElementById(group), arrElements[i]))
arrElements[i].style.visibility = 'hidden';
}
}
// Whether the given objects are overlapping
function objectsOverlapping(obj1, obj2)
{
var result = true;
var obj1Left = pageX(obj1);
var obj1Top = pageY(obj1);
var obj1Right = obj1Left + obj1.offsetWidth;
var obj1Bottom = obj1Top + obj1.offsetHeight;
var obj2Left = pageX(obj2);
var obj2Top = pageY(obj2);
var obj2Right = obj2Left + obj2.offsetWidth;
var obj2Bottom = obj2Top + obj2.offsetHeight;
if (obj1Right <= obj2Left || obj1Bottom <= obj2Top ||
obj1Left >= obj2Right || obj1Top >= obj2Bottom)
result = false;
return result;
}
// Restores all HTML select elements on the page
function restoreSelectElements()
{
if (document.getElementsByTagName)
{
var arrElements = document.getElementsByTagName('select');
if (hideSelectElems)
for (var i = 0; i < arrElements.length; i++)
arrElements[i].style.visibility = 'visible';
}
}
> Subject: New Popup-Component
> Hi there,
>
> amongst the examples you can find a new popup-component - usable with
> any content you dare to imagine (see examples, popup.jsp); attention:
> there is an overlay bug in IE which leads to select boxes shining
> through any divs above them; so don't let the popup-box show over
> forms with select-boxes.
>
> Another thing: in Mozilla/Firefox I have the problem that mouse-events
> seem to be swallowed when the mouse is sufficiently fast moved out of
> the popup-box, leading to the effect that the popup-box will not
> properly be closed. Has anybody of you got a workaround for this
> effect?
>
> regards,
>
> Martin
>
>
>
> ---------- Forwarded message ----------
> From: No Galz <[EMAIL PROTECTED]>
> To: MyFaces Discussion <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Date: Wed, 17 Nov 2004 04:05:21 -0800 (PST)
> Subject: Re: New Popup-Component
> Hii,
>
> Can someone tell us the roadmap to roll out the new
> version of myfaces and the availability of them from
> the myfaces.org.
>
> Regards,
> fargo
>
> --- Martin Marinschek <[EMAIL PROTECTED]>
> wrote:
>
> > Hi there,
> >
> > amongst the examples you can find a new
> > popup-component - usable with
> > any content you dare to imagine (see examples,
> > popup.jsp); attention:
> > there is an overlay bug in IE which leads to select
> > boxes shining
> > through any divs above them; so don't let the
> > popup-box show over
> > forms with select-boxes.
> >
> > Another thing: in Mozilla/Firefox I have the problem
> > that mouse-events
> > seem to be swallowed when the mouse is sufficiently
> > fast moved out of
> > the popup-box, leading to the effect that the
> > popup-box will not
> > properly be closed. Has anybody of you got a
> > workaround for this
> > effect?
> >
> > regards,
> >
> > Martin
> >
>
> __________________________________
> Do you Yahoo!?
> The all-new My Yahoo! - Get yours free!
> http://my.yahoo.com
>
>
>