jQuery outerWidth() နည်းလမ်း
❮ jQuery HTML/CSS နည်းလမ်းများ
ဥပမာ
<div> ဒြပ်စင်တစ်ခု၏ အပြင်ဘက်အကျယ်ကို ပြန်ပေးပါ။
$("button").click(function(){
alert($("div").outerWidth());
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
outerWidth() method သည် FIRST လိုက်ဖက်သောဒြပ်စင်၏ အပြင်ဘက်အကျယ်ကို ပြန်ပေးသည်။
အောက်ဖော်ပြပါပုံတွင် ဖော်ပြထားသည့်အတိုင်း၊ ဤနည်းလမ်းတွင် padding နှင့် border ပါဝင်သည်။
အကြံပြုချက်- အနားသတ်ကို ထည့်သွင်းရန်၊ outerWidth(true) ကိုသုံးပါ။
ဆက်စပ်နည်းလမ်းများ-
- width() - ဒြပ်စင်တစ်ခု၏ အကျယ်ကို သတ်မှတ် သို့မဟုတ် ပြန်ပေးသည်။
- height() - ဒြပ်စင်တစ်ခု၏ အမြင့်ကို သတ်မှတ်ခြင်း သို့မဟုတ် ပြန်ပေးသည်။
- innerWidth() - ဒြပ်စင်တစ်ခု၏ အကျယ်ကို ပြန်ပေးသည် ( padding ပါဝင်သည် )
- innerHeight() - ဒြပ်စင်တစ်ခု၏ အမြင့်ကို ပြန်ပေးသည် ( padding ပါဝင်သည် )
- outerHeight() - ဒြပ်စင်တစ်ခု၏အမြင့်ကို ပြန်ပေးသည် ( padding နှင့် border ပါ၀င်သည်)။
အထားအသို
$(selector).outerWidth(includeMargin)
Parameter | Description |
---|---|
includeMargin | Optional. A Boolean value specifying whether or not to include the margin
|
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
၊ မရှိ သတ်မှတ်ပါ။
width(), height(), innerHeight(), innerWidth(), outerWidth() နှင့် outerHeight() ကို အသုံးပြုနည်း
❮ jQuery HTML/CSS နည်းလမ်းများ