تغيير حجم النافذة
مثال 1
افتح نافذة جديدة ، وقم بتغيير (زيادة) العرض والارتفاع:
function openWin() {
myWindow = window.open("", "", "width=100, height=100");
}
function resizeWin() {
myWindow.resizeBy(250, 250);
}
المزيد من الأمثلة أدناه.
التعريف والاستخدام
الطريقة تغير resizeBy()
حجم النافذة بمقدار محدد.
بناء الجملة
resizeBy(width, height)
المعلمات
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. |
قيمة الإرجاع
لا أحد |
مزيد من الأمثلة
افتح نافذة جديدة ، وقم بتقليل العرض بمقدار 50 بكسل وزيادة الارتفاع بمقدار 50 بكسل:
myWindow.resizeBy(-50, 50);
باستخدام resizeBy () مع resizeTo ():
function resizeWinTo() {
myWindow.resizeTo(800, 600);
myWindow.focus();
}
function resizeWinBy() {
myWindow.resizeBy(-100, -50);
}
دعم المتصفح
resizeBy()
مدعوم في جميع المتصفحات:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |