“Ukuran jendela JavaScript” Kode Jawaban

Cara mendapatkan ketinggian jendela di JavaScript

//get screen height of the device by using
window.innerHeight
//get screen width of the device by using
window.innerWidth
Pleasant Partridge

Dapatkan JavaScript Ukuran Jendela

const window {
  width: window.innerWidth,
  height: window.innerHeight
}
Cheerful Cockroach

Dimensi jendela JS

// better than using window.innerWidth / window.innerHeight 
// because of scrollbars
const client = {
      width: document.documentElement.clientWidth,
      height: document.documentElement.clientHeight
}
P.S.

JS memeriksa lebar jendela

// Size of browser viewport.
$(window).height();
$(window).width();

// Size of HTML document (same as pageHeight/pageWidth in screenshot).
$(document).height();
$(document).width();
Cheerful Cheetah

cara mendapatkan ukuran jendela di javascript

var win = window,
    doc = document,
    docElem = doc.documentElement,
    body = doc.getElementsByTagName('body')[0],
    x = win.innerWidth || docElem.clientWidth || body.clientWidth,
    y = win.innerHeight|| docElem.clientHeight|| body.clientHeight;
alert(x + ' × ' + y);
Arex

Ukuran jendela JavaScript

let w = window.innerWidth;
let h = window.innerHeight;
naly moslih

Jawaban yang mirip dengan “Ukuran jendela JavaScript”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya