Is it possible to get the mouse position with JavaScript after page loads without any mouse movement event (without moving the mouse)?
Is it possible to get the mouse position with JavaScript after page loads without
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Real answer: No, it’s not possible.
OK, I have just thought of a way. Overlay your page with a div that covers the whole document. Inside that, create (say) 2,000 x 2,000
<a>elements (so that the:hoverpseudo-class will work in IE 6, see), each 1 pixel in size. Create a CSS:hoverrule for those<a>elements that changes a property (let’s sayfont-family). In your load handler, cycle through each of the 4 million<a>elements, checkingcurrentStyle/getComputedStyle()until you find the one with the hover font. Extrapolate back from this element to get the co-ordinates within the document.N.B. DON’T DO THIS.