2011-08-05 26 views
9

我可以在mousedown(event)事件中獲取光標位置,但不連續使用mousemove(event)(因此會浪費資源)? event.pageX回報上mousedown沒有mousemove()的mousedown()上的jQuery鼠標位置()

+3

它哪種瀏覽器?在Chrome和Firefox中對我來說很好:http://jsfiddle.net/interdream/JsaPG/3/ –

+0

@James:作品,我的代碼中的錯誤,很抱歉讓人不安:) –

+0

沒問題,我認爲可能是這樣! –

回答

12

NaN代表詹姆斯:

從 - http://jsfiddle.net/interdream/JsaPG/3/

<input type="button" id="test" value="click" style="width:200px" /> 

$("#test").mousedown(function(e) { 
    console.log(e.pageX); 
});