|
| |||||||
| |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
| | #1 (permalink) |
| Registered User Join Date: May 2003
Posts: 856
| Javascript Dynamic Pop-up Question Hey guys, I am writing some javascript code for a pop-up. Basically you hover over the div and a pop-up tooltip appears right next to it, however what I want to do is make so that depending on if the hover-over icon is too far to the top of the page, it will display it underneath the icon instead of over-top or visa versa. Here is what I got so far: These functions will show and hide the pop-up: These are the elements you hover over and what pops up And here is the code I have to determine the position of the mouse: Now according to what I read online I need to determine the browser size and then make some kind of comparison to see if the element is near the top or the bottom of the page. And depending on which it is show the pop-up but with different offsetTop and offsetLeft values. So does anyone have any experience in doing this? Help would be much appreciated. Edit: err my html isnt dispalying properly, whats the tag to get html code to dispaly properly? Another semi-related question and so simple yet I am having trouble finding the answer online. How would I go about setting an area inside quotes as a variable name. I am trying to pass a string into a function and then using the getElementById("parameter") where the string is the parameter. I tried ("'"+parameter+"'") to no avail.
__________________ "Talk all you want, but when I say I'm going to kill you, there's nothing you can do but die" Last edited by DisgruntledOrangatang : 07-07-2008 at 06:13 PM. |
| | |
| | #2 (permalink) | |||
| Never Go Full Retard Join Date: May 2002 Location: Hell
Posts: 5,684
| Quote:
Quote:
Edit: er, actually I changed it in the text I quoted and it looks like shit. Not sure why it's escaping the quotes and using awful colors. Oh well. Quote:
Last edited by Vorph : 07-08-2008 at 02:12 PM. | |||
| | |
| | #3 (permalink) |
| Registered User Join Date: May 2003
Posts: 856
| Hey vorph, appreciate it. Gotta admit though, I am a total JS newb. The scripts I currently have was from tutorials I got from searching google. So I am not sure how to do what you mentioned. I am also not even sure I fully comprehend what you said -_-. Why do I need to reduce the offset to zero? Couldn't I just do a comparison to see if the mouse position is on the area of the top half or bottom half by grabbing mouse pos in relation to window size? Idk, like I said I am a newb at JS.
__________________ "Talk all you want, but when I say I'm going to kill you, there's nothing you can do but die" |
| | |
| | #4 (permalink) |
| Never Go Full Retard Join Date: May 2002 Location: Hell
Posts: 5,684
| I'd suggest looking at DHTML JavaScript Tooltips either for ideas or just using it directly. And yeah, ignore what I said about reducing to zero, I misread how you said you wanted to handle it when the tooltip was too close to an edge. |
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |