[Javascript] Changin pop up location?

Skip Evans skip at bigskypenguin.com
Tue Mar 11 23:19:34 CDT 2008


Hey all,

Just joined the list so I'll preempt your 
"welcomes" now:

Thank you, thanks, great to see you all. I'm here 
all weekend at the Flamingo Lounge, enjoy the buffet.

Now here's my question. I'm using Scriptaculous to 
create a pop up with the following class definition:

.popup_panel {
     position: absolute;
     text-align: left;
     top: 100px;
     left: 180px;
     margin: 0 0 1px 0;
     border: 2px solid #555;
     z-index: 100;
     background-color: #fff;
     color: #999;
}

The HTML code used to create the template has an 
id value of the same name:

<div id="popup_panel" class="popup_panel">...</div>

Then in the javascript I try to adjust the 
position of the pop up with the following

var xpos=e.pageX;
var ypos=e.pageY;

// set the position of the pop up in the browser.
var popup=document.getElementById('popup_panel');
popup.style.top=xpos-50;
popup.style.left=ypos-50;

It gets the pageX and pageY values fine (tested 
with a call to alert function), but does not 
adjust the popup's position beyond what is set in 
the CSS.

Any help would be greatly appreciated.

-- 
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/



More information about the Javascript mailing list