JavaScript ရှိ window ၏ အရွယ်အစားများ
အောက်ပါ properties များသည် scroll bar ပါဝင်မှုမရှိသော browser window ၏ အရွယ်အစားများကို ပြသပေးသည် -
let w = document.documentElement.clientWidth; // အကျယ်
let h = document.documentElement.clientHeight; // အမြင့်
အောက်ပါ properties များသည် scroll bar ပါဝင်သည် -
let w = window.innerWidth; // အကျယ်
let h = window.innerHeight; // အမြင့်
properties အမျိုးအစားနှစ်ခုကြားက ခြားနားချက်သည် scroll bar ၏ အရွယ်အစားကို ဖော်ပြပေးသည် -
let w1 = document.documentElement.clientWidth;
let w2 = window.innerWidth;
console.log(w2 - w1);
ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window ၏ အကျယ်နှင့် အမြင့်ကို ထုတ်ပြပါ။
ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window တွင် ဒေါင်လိုက် scroll bar ရှိမရှိ စစ်ဆေးပါ။
ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window တွင် အလျားလိုက် scroll bar ရှိမရှိ စစ်ဆေးပါ။