Click to See Complete Forum and Search --> : Script trouble when trying dynamically position a DIV above a button..??


DoyleRules
05-12-2003, 08:11 PM
Hello all, :(
   this might be a really stupid question, but I have been stumped on this for weeks. I am trying to position a DIV immediately ABOVE a button. I want it to be, not a drop DOWN menu, but a jump UP menu, ...I guess, I can't think of a better way to describe it. But basically I want it to appear above the button as oppose to all the scripts that are out there for appearing below.
   Part of the twist to this, is that the whole page including the button is designed so that no matter what the size of the screen is, or what it is resized to, all of the content remains positioned correctly and looks the same without overlapping or horizontal scroll bars.
   I want to keep this effect, but I am having trouble finding a script that will allow a menu to basically offset itself so many pixels from a button or ID. I have used a script that looks at were the mouse cusor is and offsets a DIV from that. It's nice but not quite what I want. Plus it conflicts with another function within the scripting in the HEAD tag of the page.
   Below is a link to the current project I am working on so that you can look at any part of any of my scripting so far if need be.

http://mikebdoyle.tripod.com/myWork/index.htm

   I appreciate ANYONE's help because I have worked really hard at this for weeks, and now I have run into a wall and cannot seem to get around it.

Thanks,
<--=MikeDoyle=--<< :)

khalidali63
05-12-2003, 11:30 PM
What you can do is something like this.
1 hard code the width and height and length of the button,so that you know exactly.
2.Every time page is resized,get the buttons left and top location by using

in object.offetLeft and obj.offsetTop

Now you should be able to position the div layer on top of the button all the time..make sens?

khalidali63
05-13-2003, 01:07 AM
Originally posted by Dave Clark
You do not need to hard-code ..........
Dave

How about leaving upto the member to decide what he/she may need or what may not need...???

khalidali63
05-13-2003, 08:55 AM
naah..just a friendly suggestion I mad...not touchy at all..:D

DoyleRules
05-13-2003, 09:46 AM
WOW, thanks for replying so fast!!
I like both replies!! :), but not for sure which one will be shorter. Also, I hate to admit to being stupid, but I am unsure how I would empliment either of those into my current script. Also, would you suggest putting the layer in the bottom frame's code, or in the middle frame, where the text is at?

Thanks again: Dave and khalidali63 especially, and anyone else who would like to lend some suggestion!! :)

~ Mike

DoyleRules
05-13-2003, 09:24 PM
Hello khalidali63,
I appreciate your help with my question about positioning a DIV over a button, even when the page is being resized. I apologize, I am not as javascript savay as you and I am not for sure how to code this. Some of what you said made since to me, but I am much better at looking at existing code and editing it, then creating it from scratch,
Would you mind making an example for me of how you would code something like this.
Again, just as a refresher, I am trying to position a DIV tag, above, not on top of, a button. And make it so that if the page is at a different resolution or even resized, that when this button is clicked on, the DIV always appears right above it, ..or off by a couple of pixels.

&nbsp; Thanks also, Dave Clark for replying.

Thanks again khalidali63,
<--=MikeDoyle=--<<

khalidali63
05-13-2003, 10:16 PM
Let me know if this is what you wanted...

http://68.145.35.86/skills/javascripts/FixedPositionDiv.html

DoyleRules
05-14-2003, 02:38 AM
Hey Khalid,
&nbsp; sorry, but not at all what I am trying to do. &nbsp;The following is the address to a sample page that is the basics of what I am trying to do. &nbsp;I keep getting an error when trying to make 2 functions in the script work with each other. &nbsp;Plus I want to make the Color picker position itself over the button, like it does, but by looking at where the button is, and not the coordinants of the mouse cursor.

http://mikebdoyle.tripod.com/myWork/test.htm

Thanks,
MD

khalidali63
05-14-2003, 06:07 AM
Originally posted by DoyleRules
.......when this button is clicked on, the DIV always appears right above it, ..or off by a couple of pixels.
<--=MikeDoyle=--<<

Gotcha....
Take a look...I have positioned the div to appear at the right bottom corner of the button,you can play with the positionss...cahnge the following to

divObj.style.left = w + 68 + "px";
divObj.style.top = h + 22 + "px";

to this

divObj.style.left = w + "px";
divObj.style.top = h + "px";

to make div appear right on top of the button.

DoyleRules
05-20-2003, 11:31 AM
Hello khalidali63,
I know it's been a while since I replied to this, mainly because your solution worked! It worked really well, and I thank you for it!! ...I've got a new piece to the puzzel now though. I am trying to do this in a frame, and I would like the layer to overlap from the bottom frame into the top frame. So, far the only code I have seen that can make a layer/DIV overlap a frame, is Microsoft's,
window.createPopup() object. Is there anything else, any attributes that could have this capability?

Thanks,