PDA

View Full Version : Strange Behaviour with Popup information Box



Trevzilla
06-10-2008, 02:11 AM
1) Script Title: Popup information box II

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

3) Describe problem:

I've run into a little error with this code, and I'm hoping someone knows what the problem is. The code works fine in Firefox, however when I run it on my page in internet explorer, the popup information box does not show up in the correct position (directly under the mouse) after one has scrolled down the page. The further the user scrolls down the page, the farther off the info box becomes.

You can see it in action here:
http://www.photomosaicproject.com/photographs.php
(Note: If you do not have to scroll, type in 1, or 2 in the change column number box)

Someone on this site told me to change the example code a little so that it would be compatible with firefox, and the change I made worked. . .so I don't know if that is the change that is causing this problem or not, but here is my updated code from the example. (I only changed the get_mouse function)


function get_mouse(e){
var x = (ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left= x + Xoffset +"px";
var y = (ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top= y + Yoffset + "px";
}

Maybe it is that code that is giving the problem in IE now. (Maybe I have to do an if/else statement, and check for what browser the user is using. . .I don't really know though.)

Any ideas out there?

Nile
06-10-2008, 03:13 AM
I'd recommend using this one:
http://dynamicdrive.com/dynamicindex5/popinfo3.htm
or this:
http://dynamicdrive.com/dynamicindex5/dhtmltooltip.htm

Trevzilla
06-10-2008, 06:01 AM
I used the second one, and it works like a charm! Thanks for the heads up!

Minos
06-10-2008, 12:49 PM
Yeah, I helped you get it going for Firefox...The reason it got screwy for IE...Microsoft is retarded. As of IE6, document.body is replaced by document.documentElement. The script Nile recommended has this check built in. Glad you got it working.

Nile
06-10-2008, 02:25 PM
Yes, that was an old version. Always check to see if there are new versions of the script.