jQuery height() နည်းလမ်း
❮ jQuery HTML/CSS နည်းလမ်းများ
ဥပမာ
<div> ဒြပ်စင်တစ်ခု၏ အမြင့်ကို ပြန်ပေးပါ။
$("button").click(function(){
alert($("div").height());
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
အမြင့်() နည်းလမ်းသည် ရွေးချယ်ထားသော အစိတ်အပိုင်းများ၏ အမြင့်ကို သတ်မှတ် သို့မဟုတ် ပြန်ပေးသည်။
ဤနည်းလမ်းကို အမြင့်ပြန်ပို့ရန် အသုံးပြုသောအခါ ၊ ၎င်းသည် FIRST လိုက်ဖက်သောဒြပ်စင်၏ အမြင့်ကို ပြန်ပေးသည်။
အမြင့် သတ်မှတ်ရန် ဤနည်းလမ်းကိုအသုံးပြုသောအခါ ၊ ၎င်းသည် လိုက်ဖက်သောဒြပ်စင်အားလုံး၏အမြင့်ကို သတ်မှတ်ပေးသည်။
အောက်ဖော်ပြပါပုံတွင် ဖော်ပြထားသည့်အတိုင်း၊ ဤနည်းလမ်းတွင် padding၊ border သို့မဟုတ် margin မပါဝင်ပါ။
ဆက်စပ်နည်းလမ်းများ-
- width() - ဒြပ်စင်တစ်ခု၏ အကျယ်ကို သတ်မှတ် သို့မဟုတ် ပြန်ပေးသည်။
- innerWidth() - ဒြပ်စင်တစ်ခု၏ အကျယ်ကို ပြန်ပေးသည် ( padding ပါဝင်သည် )
- innerHeight() - ဒြပ်စင်တစ်ခု၏ အမြင့်ကို ပြန်ပေးသည် ( padding ပါဝင်သည် )
- outerWidth() - element တစ်ခု၏ အကျယ်ကို ပြန်ပေးသည် ( padding နှင့် border ပါ၀င်သည် )
- outerHeight() - ဒြပ်စင်တစ်ခု၏အမြင့်ကို ပြန်ပေးသည် ( padding နှင့် border ပါ၀င်သည် )
အထားအသို
အမြင့်ကို ပြန်ပေးပါ။
$(selector).height()
အမြင့်ကို သတ်မှတ်ပါ-
$(selector).height(value)
လုပ်ဆောင်ချက်တစ်ခုသုံးပြီး အမြင့်ကို သတ်မှတ်ပါ-
$(selector).height(function(index,currentheight))
Parameter | Description |
---|---|
value | Required for setting height. Specifies the height in px, em, pt, etc. Default unit is px |
function(index,currentheight) | Optional. Specifies a function that returns the new height of selected elements
|
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
မတူညီသောယူနစ်များကို အသုံးပြု၍ ဒြပ်စင်တစ်ခု၏အမြင့်ကို သတ်မှတ်နည်း
ဒြပ်စင်တစ်ခု၏အမြင့်ကိုတိုးရန် ဖန်ရှင်ကိုအသုံးပြု၍
အမြင့်ကို ပြန်ပေးနည်း စာရွက်စာတမ်းနှင့် ဝင်းဒိုးဒြပ်စင်များ၏ လက်ရှိအမြင့်ကို ပြန်ပေးနည်း။
width(), height(), innerHeight(), innerWidth(), outerWidth() နှင့် outerHeight() ကို အသုံးပြုနည်း
❮ jQuery HTML/CSS နည်းလမ်းများ