jQuery toggle() နည်းလမ်း
ဥပမာ
<p> ဒြပ်စင်အားလုံးအတွက် ဖျောက်နှင့် ရှိုးများကြားတွင် ပြောင်းပါ-
$("button").click(function(){
$("p").toggle();
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
toggle() နည်းလမ်းသည် ရွေးထားသော အစိတ်အပိုင်းများအတွက် hide() နှင့် show() ကြားတွင် ပြောင်းပေးသည်။
ဤနည်းလမ်းသည် ရွေးချယ်ထားသော အစိတ်အပိုင်းများကို မြင်နိုင်စွမ်းရှိစေရန် စစ်ဆေးသည်။ အစိတ်အပိုင်းတစ်ခုကို ဝှက်ထားလျှင် show() ကို လုပ်ဆောင်သည်။ အစိတ်အပိုင်းတစ်ခုကိုမြင်ပါက hide() ကို run သည် - ၎င်းသည် toggle effect ကိုဖန်တီးပေးသည်။
မှတ်ချက် ။
အကြံပြုချက်- ဤနည်းလမ်းကို စိတ်ကြိုက်လုပ်ဆောင်ချက်များအကြား ပြောင်းရန်လည်း အသုံးပြုနိုင်သည်။
အထားအသို
$(selector).toggle(speed,easing,callback)
Parameter | Description |
---|---|
speed | Optional. Specifies the speed of the hide/show effect Possible values:
|
easing | Optional. Specifies the speed of the element in different points of the animation. Default value is "swing" Possible values:
|
callback | Optional. A function to be executed after the toggle() method is completed To learn more about callback, visit our jQuery Callback chapter |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ရာမီတာ
ကိုအသုံးပြုခြင်း ဝှက်ခြင်း/ပြသမှုအကျိုးသက်ရောက်မှု၏အမြန်နှုန်းကိုသတ်မှတ်ရန် အမြန်နှုန်းကန့်သတ်ဘောင်ကိုအသုံးပြုနည်း။
ကိုအသုံးပြုခြင်းဖြင့် hide/show effect များကြားတွင် toggle လုပ်သည့်အခါ callback parameter ကိုအသုံးပြုနည်း။