?
This document uses PHP Chinese website manual Release
獲得鼠標(biāo)指針在頁面中的位置:
效果預(yù)覽 ?$(document).mousemove(function(event){
$("span").text(event.pageX + ", " + event.pageY);
});
當(dāng)鼠標(biāo)指針在指定的元素中移動時(shí),就會發(fā)生 mousemove 事件。
mousemove() 方法觸發(fā) mousemove 事件,或添加當(dāng)發(fā)生 mousemove 事件時(shí)運(yùn)行的函數(shù)。
注意:用戶把鼠標(biāo)移動一個(gè)像素,就會發(fā)生一次 mousemove 事件。處理所有 mousemove 事件會耗費(fèi)系統(tǒng)資源。請謹(jǐn)慎使用該事件。
觸發(fā)被選元素的 mousemove 事件:
$(selector).mousemove() 實(shí)例 ?
添加函數(shù)到 mousemove 事件:
$(selector).mousemove(function) 實(shí)例 ?
參數(shù) | 描述 |
---|---|
function | 可選。規(guī)定 mousemove 事件觸發(fā)時(shí)運(yùn)行的函數(shù)。 |