I tested in IE :D

On Fri, Feb 27, 2009 at 2:20 PM, d3r1v3d (Gavin Mulligan) <vtga...@gmail.com
> wrote:

>
> Yep, I tried your code in a demo page and it confirmed my initial
> suspicions. It works great when the DOM of the test page is
> initialized with the mouse coordinates. However, this only happens
> when the mouse is initially moved after the page is refreshed.
>
> Put your mouse in the middle of the test page, and hit F5 without
> moving your mouse. No alerts will pop up until your mouse moves at
> least a pixel. If you continue slamming refresh, no alerts at all will
> display. The 'mouseover' event doesn't trigger until the mouse is
> moved over the body of the web page. Additionally, the same is true if
> you use your mouse to manually hit the refresh button, since it exists
> outside the confines of the page.
>
> Note: I tested in Chrome and Firefox 3 on Windows.
>
> - Gavin
>
> On Feb 27, 8:47 am, Andrea Giammarchi <andrea.giammar...@gmail.com>
> wrote:
> > I do not need to move the mouse to fire that event ... have you tried?
> >
> > write this wherever and press F5 without move the mouse ...
> >
> > document.documentElement.onmouseover = function(){
> >     alert("Who moved?");
> >
> > };
> >
> > Regards
> >
> > On Fri, Feb 27, 2009 at 12:54 PM, d3r1v3d (Gavin Mulligan) <
> >
> > vtga...@gmail.com> wrote:
> >
> > > Yes, but that requires the 'mouseover' event to be executed; which, in
> > > turn, requires that a user move their mouse over the page at least a
> > > pixel for it to trigger.
> >
> > > I believe Marcus was asking if it was possible to retrieve a user's
> > > current mouse position without moving the cursor at all.
> >
> > > - Gavin
> >
> > > On Feb 27, 4:17 am, Andrea Giammarchi <andrea.giammar...@gmail.com>
> > > wrote:
> > > > $(document.documentElement).bind("mouseover", function(eventObj){
> > > >     alert([eventObj.clientX, eventObj.clientY]);
> >
> > > > });
> >
> > > > On Thu, Feb 26, 2009 at 2:49 PM, d3r1v3d (Gavin Mulligan) <
> > > vtga...@gmail.com
> >
> > > > > wrote:
> >
> > > > > Hi Marcus,
> >
> > > > > The function I've always used for obtaining the current mouse
> position
> > > > > is:
> > > > > function getMousePosition(eventObj){
> > > > >    if (eventObj.pageX && eventObj.pageY)
> > > > >    {
> > > > >        return {x: eventObj.pageX, y: eventObj.pageY};
> > > > >    }
> >
> > > > >    return {x: (eventObj.clientX + document.body.scrollLeft -
> > > > > document.body.clientLeft),
> > > > >              y: (eventObj.clientY + document.body.scrollTop -
> > > > > document.body.clientTop)};
> > > > > }
> >
> > > > > However, the major caveat here is that you need to bind this
> function
> > > > > to some event. A given browser will keep track of mouse movements
> > > > > within itself, but I do not believe it tracks movements outside its
> > > > > window. Additionally, unless a user has moved their mouse within a
> > > > > given web page, I don't believe the DOM for that page is updated
> with
> > > > > the appropriate coordinates. So, long story short, I don't think
> what
> > > > > you're asking is possible.
> >
> > > > > - Gavin
> >
> > > > > On Feb 26, 9:41 am, smurkas <marcus.dalg...@gmail.com> wrote:
> > > > > > Hello. I ran into this problem today. I would like to know the
>  mouse
> > > > > > position when  the page has loaded without the user having to
>  move
> > > > > > the mouse. I have tried just getting the  xy-values but it
> returned
> > > > > > undefined if I triggered on document load and 0 0 if I just
> trigger
> > > > > > different mouse events when  the page has loaded via firebug.
> >
> > > > > > Is it possible to  get the values without moving the  mouse and
> if
> > > so,
> > > > > > how do I do it?
> >
> > > > > > Yours  kindly, Marcus.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to