jQuery mousemove() နည်းလမ်း
ဥပမာ
စာမျက်နှာတစ်ခုအတွင်း mouse pointer ၏ အနေအထားကို ရယူပါ။
$(document).mousemove(function(event){
$("span").text(event.pageX + ", " + event.pageY);
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
မောက်စ်ညွှန်ပြသည့်အရာသည် ရွေးချယ်ထားသည့်အရာအတွင်း မောက်စ်ရွှေ့သည့်အခါတိုင်း ဖြစ်ပေါ်သည်။
mousemove() method သည် mousemove event ကို အစပျိုးပေးသည်၊ သို့မဟုတ် mousemove event ဖြစ်ပေါ်လာသောအခါ run ရန် function တစ်ခုကို ပူးတွဲပေးသည်။
မှတ်ချက်- အသုံးပြုသူတစ်ဦးသည် mouse one pixel ကိုရွှေ့လိုက်တိုင်း mousemove event တစ်ခု ဖြစ်ပေါ်ပါသည်။ မောက်စ်ရွှေ့သည့် အစီအစဉ်အားလုံးကို လုပ်ဆောင်ရန် စနစ်ရင်းမြစ်များ လိုအပ်သည်။ ဤဖြစ်ရပ်ကို ဂရုတစိုက်အသုံးပြုပါ။
အထားအသို
ရွေးချယ်ထားသော အစိတ်အပိုင်းများအတွက် mousemove event ကို အစပျိုးပါ-
$(selector).mousemove()
မောက်စ်ရွှေ့သည့်ဖြစ်ရပ်သို့ လုပ်ဆောင်ချက်တစ်ခုကို ပူးတွဲပါ-
$(selector).mousemove(function)
Parameter | Description |
---|---|
function | Optional. Specifies the function to run when the mousemove event is triggered |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
အကြား ခြားနားချက်ကို mouseover(), mouseenter() နှင့် mousemove() အကြား ခြားနားချက်ကို ပြသသည်။