Odd popup behavior in HATS

Off
Strongback Consulting

Here is an issue that has cropped up on the 7.x release of HATS. Its very very minor one, but can eat up a bunch of hours to troubleshoot.

Lets say you have a popup selection widget, and specify you want it to display with the image rather than a button or link.

Let’s also say that your HATS widget is placed within an absolute positioned element (i.e. style=”position: absolute” or within a style selector of your CSS file).

You will have two issues. One, the popup will be positioned relative to the absolutely positioned element that contains it. You can get around that by forcing the popup DIV to be a child of the BODY element in the popup(popupid) function:

document.body.appendChild(content);

Next, there will be an issue in IE where if a user clicks the popup, closes it and re-opens the popup, the popup will migrate upwards or away from where it first opened. This is only an IE issue and it applies to version 6,7,and 8. You’ll need to add the following to the getButton(popupid) method – just above the final return statement:


// The following is to account for a popup that is triggered by an image.
var imgs = document.getElementsByTagName("IMG");
for (i=0;i
var element = imgs[i];
var onclickstring=" "+element.onclick;
if (onclickstring.indexOf(popupid)!=-1 ) {
// now that we have found the element
return element;
}
}

Comments are closed.