...

View Full Version : Prototype pointerX and pointerY methods with event observer?



Sleeping_Troll
07-22-2009, 01:29 AM
Can anyone give me an example of proper syntax for the pointerX and PointerY methods with an event observer in prototype framework?
I am trying to reposition an image to center on the cursor on a mouseover event... this is the site http://orbzorbz.com
This is the code I have...


function observerover(i){
Orb[i].Img.observe('mouseover', function(event){
Orb[i].Static=1;
this.style.zIndex=5000;
this.style.width=300+'px';
this.style.height=300+'px';
this.style.left=this.pointerX(event)-150+"px";
this.style.top=this.pointerY(event)-150+"px";
while($('panelMain').down()){
$('panelMain').down().remove();
}
$('panelMain').insert(Orb[i].Panel);
});
}

fside
07-22-2009, 05:49 AM
this.style.left=this.pointerX(event)-150+"px";


I believe pointerX, which is supposedly the page position, scroll+offset, is a method of the "Event" object. In recent Prototype, I wonder if "event.pointerX()" wouldn't work, as well. I don't use Prototype, so I'm just going by what I've read.

And, there's a forum here, Javascript Frameworks. Yes, I know, Prototypes is a library not a framework. But it's the name they chose, here. So. Better place for your question?

Sleeping_Troll
07-22-2009, 12:20 PM
Thanx!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum