jQuery scroll() နည်းလမ်း
ဥပမာ
ဒြပ်စင်တစ်ခုအတွက် scroll ကိုအသုံးပြုသည့်အကြိမ်အရေအတွက်ကိုရေတွက်ပါ-
$("div").scroll(function(){
$("span").text(x += 1);
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
အသုံးပြုသူသည် သတ်မှတ်ထားသော ဒြပ်စင်သို့ လှိမ့်သည့်အခါ လှိမ့်ခြင်းဖြစ်ရပ် ဖြစ်ပေါ်သည်။
scroll event သည် scrollable element များအားလုံးနှင့် window object (browser window) အတွက် အလုပ်လုပ်ပါသည်။
scroll() method သည် scroll event ကို အစပျိုးပေးသည်၊ သို့မဟုတ် scroll event ဖြစ်ပေါ်လာသောအခါ လုပ်ဆောင်ရန် function တစ်ခုကို ပူးတွဲပေးပါသည်။
အထားအသို
ရွေးချယ်ထားသော အစိတ်အပိုင်းများအတွက် လှိမ့်ပွဲကို အစပျိုးပါ-
$(selector).scroll()
Scroll Event တွင် လုပ်ဆောင်ချက်တစ်ခုကို ပူးတွဲပါ-
$(selector).scroll(function)
Parameter | Description |
---|---|
function | Optional. Specifies the function to run when the scroll event is triggered |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ကြားတွင် ကွဲပြားသော scroll position များရှိ အတန်းများကြားတွင် ပြောင်းရန် လုပ်နည်း။