Log in

View Full Version : Anchored DIV



TimFA
12-23-2007, 12:01 AM
Ok, I've Googled to no avail. I am curious as to how sometimes on click a DIV or table or whatever, will appear where you click, is it anchored somehow using CSS, or is there some type of JavaScript form.here() or something I was not aware of? Please and thank you.

Tim

edit: i know someone here knows how to do it....

Medyman
12-23-2007, 10:10 PM
http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
http://www.netlobo.com/div_hiding.html

TimFA
12-23-2007, 10:14 PM
You have mistaken what I mean't, I know how to show and hide, I want to know how a DIV appears "over" everything else, as in like a tool tip. I can do that exact effect described in your second link, and more easily. The way that it doesn't have a static location, it can be wherever your cursor is.

edit: i just re-read my first post, and not that this will confuse anyone, but to clarify when I said form.here I was saying form (as in make) at this location, not form like a contact form.

BLiZZaRD
12-24-2007, 05:19 AM
Something like this then? (http://www.dynamicdrive.com/dynamicindex5/balloontooltip.htm)

I too, am not exactly sure what you are trying to describe. I understand the idea, just not the visual. If you have an example page we can take a look.

If it is not the above link then I am thinking it will be a pop up type of action using JS to show it on the page.

TimFA
12-24-2007, 05:23 PM
I understand how it shows itself, I am asking like with Windows, a tool tip how its location is not static, it is wherever you happen to be when it appears, other than the fact you have to be inside the object. I guess I am asking how to make JavaScript calculate where your mouse is almost.

edit: and Blizzard your link was close, but since I'm not necessarily going to use it, and I was just asking to add it to what I can do if needed, going with something other than what I asked about was not an option.

BYK
12-24-2007, 06:31 PM
I wrote a code a few years ago which checked the spaces in the page(veritcal&horizontal) and the width&hieght of a container and positioned it to the best place possible. If this is what you want, I can digg and find that code? :)

TimFA
12-24-2007, 11:09 PM
No don't worry about it then, I was just curious as to what method is used.

BYK
12-24-2007, 11:30 PM
As I remember so far is that it was similar to the menu pop-up system of the Windows. It first checked if it can open the pop-up to the right of the cursor, which meant the left pos is equal to the cursor's left pos, and then to the same thing for the vertical direction for downwards. If any of them does not have the sufficiant space for a complete view, ith then subtracts the offsetHeight or the offsetWidth of the pop-up element form the current position of the cursor and voila :)