jQuery hover() နည်းလမ်း
ဥပမာ
mouse pointer သည် ၎င်းအပေါ်တွင် ပျံဝဲနေသောအခါ <p> element တစ်ခု၏ နောက်ခံအရောင်ကို ပြောင်းပါ-
$("p").hover(function(){
$(this).css("background-color", "yellow");
}, function(){
$(this).css("background-color", "pink");
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
မောက်စ်ညွှန်ပြချက်သည် ရွေးချယ်ထားသော အစိတ်အပိုင်းများပေါ်တွင် ပျံဝဲသောအခါတွင် ရွှေ့ရန်() နည်းလမ်းသည် လုပ်ဆောင်ရန် လုပ်ဆောင်မှုနှစ်ခုကို သတ်မှတ်ပေးသည်။
ဤနည်းလမ်းသည် mouseenter နှင့် mouseleave ဖြစ်ရပ်များကို အစပျိုးစေသည်။
မှတ်ချက်- လုပ်ဆောင်ချက်တစ်ခုသာ သတ်မှတ်ထားပါက၊ ၎င်းကို mouseenter နှင့် mouseleave ဖြစ်ရပ်နှစ်ခုလုံးအတွက် လုပ်ဆောင်မည်ဖြစ်သည်။
အထားအသို
$(selector).hover(inFunction,outFunction)
Parameter | Description |
---|---|
inFunction | Required. Specifies the function to run when the mouseenter event occurs |
outFunction | Optional. Specifies the function to run when the mouseleave event occurs |