Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:07:38+00:00 2026-05-26T04:07:38+00:00

So, like the question specifies, is there a way to trigger a mousemove event

  • 0

So, like the question specifies, is there a way to trigger a mousemove event in jQuery which also sends the mouse coordinates to the event Object?

So far my code can trigger the mousemove using the .trigger(event) function but the event.pageX and event.pageY are undefined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:07:39+00:00Added an answer on May 26, 2026 at 4:07 am

    I don’t believe it possible to get the mouse coordinates on demand via JavaScript / jQuery; however if you bind the position to a global var you can then access them at anytime throughout the document like this:

    $(document).ready(function(){
       $().mousemove(function(e){
          window.xPos = e.pageX;
          window.yPos = e.pageY;
       }); 
    });
    

    for a less CPU intensive option, you can add a timeout, although you trade performance for a slight delay in knowing where the mouse is:

    function getMousePosition(timeoutMilliSeconds) {
        $(document).one("mousemove", function (event) {
            window.xPos = event.pageX;
            window.yPos = event.pageY;
            setTimeout("getMousePosition(" + timeoutMilliSeconds + ")", timeoutMilliSeconds);
        });
    }
    getMousePosition(100);
    

    You should now be able to access the window.xPos and window.yPos from anywhere in the document using either solution without needing to trigger a faux event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this basic question : is there a way to declare a group
Is there any way to retrieve the index of the element on which a
Like the question says, if I have a request for a page on my
Like this question , except T-SQL instead of php. 206275947 = 2062759.47 etc. The
Like my question, i need to generate random numbers that have identical pairs between
I know a question like this was already asked, but the situation is a
Kind of like this question I have many text snippets that I use many,
This is more like a question of principle. I made a table with 100%
It's quite possible a question like this has been asked before, but I can't
You may think this question is like this question asked on StackOverflow earlier. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.