Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prototype pointerX and pointerY methods with event observer?

    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...
    Code:
    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);
    	});
    }
    Last edited by Sleeping_Troll; 07-22-2009 at 02:53 AM.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Posts
    301
    Thanks
    2
    Thanked 30 Times in 30 Posts
    Quote Originally Posted by Sleeping_Troll View Post
    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?

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanx!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •