Jendela bergerakDengan()
Contoh
Buka jendela baru dan pindahkan 250px relatif terhadap posisinya saat ini:
function openWin()
{
myWindow = window.open('', '', 'width=400, height=400');
}
function moveWin()
{
myWindow.moveBy(250, 250);
}
Lebih banyak contoh di bawah ini.
Definisi dan Penggunaan
Metode moveBy()
memindahkan jendela sejumlah piksel relatif terhadap koordinat saat ini.
Sintaksis
window.moveBy(x, y)
Parameter
Parameter | Description |
x | Required. A positive or negative number. The number of pixels to move the window horizontally. |
y | Required. A positive or negative number. The number of pixels to move the window vertically. |
Nilai Kembali
TIDAK ADA |
Lebih Banyak Contoh
Menggunakan moveBy() bersama dengan moveTo():
function moveWinTo() {
myWindow.moveTo(150, 150);
}
function moveWinBy() {
myWindow.moveBy(75, 75);
}
Dukungan Peramban
moveBy()
didukung di semua browser:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |