Ubah ukuran jendelaDengan()
Contoh 1
Buka jendela baru, dan ubah ukuran (tambahkan) lebar dan tinggi:
function openWin() {
myWindow = window.open("", "", "width=100, height=100");
}
function resizeWin() {
myWindow.resizeBy(250, 250);
}
Lebih banyak contoh di bawah ini.
Definisi dan Penggunaan
Metode resizeBy()
ini mengubah ukuran jendela dengan jumlah tertentu.
Sintaksis
resizeBy(width, height)
Parameter
Parameter | Description |
width | Required. A positive or a negative number. The number of pixels to resize the width by. |
height | Required. A positive or a negative number. The number of pixels to resize the height by. |
Nilai Kembali
TIDAK ADA |
Lebih Banyak Contoh
Buka jendela baru, dan kurangi lebarnya sebesar 50px dan tambah tingginya sebesar 50px:
myWindow.resizeBy(-50, 50);
Menggunakan resizeBy() dengan resizeTo():
function resizeWinTo() {
myWindow.resizeTo(800, 600);
myWindow.focus();
}
function resizeWinBy() {
myWindow.resizeBy(-100, -50);
}
Dukungan Peramban
resizeBy()
didukung di semua browser:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |