JavaScript ရှိ window ၏ အရွယ်အစားများ

အောက်ပါ properties များသည် scroll bar ပါဝင်မှုမရှိသော browser window ၏ အရွယ်အစားများကို ပြသပေးသည် -

javascriptlet w = document.documentElement.clientWidth;  // အကျယ်
let h = document.documentElement.clientHeight; // အမြင့်

အောက်ပါ properties များသည် scroll bar ပါဝင်သည် -

javascriptlet w = window.innerWidth;  // အကျယ်
let h = window.innerHeight; // အမြင့်

properties အမျိုးအစားနှစ်ခုကြားက ခြားနားချက်သည် scroll bar ၏ အရွယ်အစားကို ဖော်ပြပေးသည် -

javascriptlet w1 = document.documentElement.clientWidth;
let w2 = window.innerWidth;

console.log(w2 - w1);
Задание 1

ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window ၏ အကျယ်နှင့် အမြင့်ကို ထုတ်ပြပါ။

Задание 2

ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window တွင် ဒေါင်လိုက် scroll bar ရှိမရှိ စစ်ဆေးပါ။

Задание 3

ခလုတ်တစ်ခုကို နှိပ်လိုက်သည့်အခါ window တွင် အလျားလိုက် scroll bar ရှိမရှိ စစ်ဆေးပါ။