Can I get cursor position at mousedown(event)
event, without using mousemove(event)
continuously (thus waisting resources)? event.pageX
returns NaN
on mousedown
-
3It which browser? It's fine for me in Chrome and Firefox: jsfiddle.net/interdream/JsaPG/3– James AllardiceCommented Aug 5, 2011 at 7:21
-
@James: works, bug in my code, sorry for troubling : )– Jakub M.Commented Aug 5, 2011 at 7:24
-
No problem, I thought that might be the case!– James AllardiceCommented Aug 5, 2011 at 7:26
-
@Jakub, can you provide an answer? then others can learn from your mistake. This isn't just a Q&A site, but also a reference of sorts :)– Antony ScottCommented Aug 5, 2011 at 7:30
-
1@Jakub - My "answer" isn't really an answer (which is why I posted it as a comment). It would probably be more helpful to other users who come across this page if you post a description of what the problem was and how you fixed it. You can post it as an answer to your own question.– James AllardiceCommented Aug 5, 2011 at 7:43
|
Show 1 more comment
1 Answer
On behalf of James:
from - http://jsfiddle.net/interdream/JsaPG/3/
<input type="button" id="test" value="click" style="width:200px" />
$("#test").mousedown(function(e) {
console.log(e.pageX);
});