File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Mouseover popup location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Mouseover popup location" Watch "Mouseover popup location" New topic
Author

Mouseover popup location

Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I have a problem with a mouseover popup box (div element not new window). It displays and hides properly and if I don't attempt to modify where it apears it appears to the bottom right of the mouse, however in some cases this puts it off the bottom of the screen. Because of the layout of the page it would be nice to 'simply' place the bottom right corner on the mouse instead of the top left. However if I attempt to set the top, left, bottom, or right of the style object (I hope that made sense) it puts the box far away in odd places and sometimes off the screen. I think part of the problem is that the section that has the mouseover is in a frame that scrolls. Scrolling also seems to have an effect as to where the box pops up.

This is the js function that creats the popup. As it is, with the commented sections left out, the box appears to the bottom right of the mouse curser.



Does anybody have any idea how to make the box popup where I want it?

Thanks ahead of time for the help.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I just wrote this real quick:




You need to adapt it to show and hide the box and maybe a lock to keep it in place.

hope this helps
Eric
[ January 31, 2005: Message edited by: Eric Pascarello ]
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Thank you so much!! That worked out great. I had to modify it a little, and I ended up sticking it all in one function, but here is the final code:



I used the getElementsByTagName because there are several of these popups in a dynamic table and I needed to get the right one. Other than that I don't think I changed much.

Here is the relevant css information.


Thank you again.

Now on the next iteration I'll probably have to size the popup window to fit the table in it.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you may find out that you may need to replace the code



with



I think I goofed.
Eric
[ February 01, 2005: Message edited by: Eric Pascarello ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mouseover popup location