I remember seeing a google maps mashup / music video that created, resized, and moved windows on the screen. What javascript methods are used to do this?
JavaScript allows you to move a window either relatively (by the amount specified), or absolutely (to the coordinates on the screen specified). For your convenience, here are the related window methods again: - moveBy () method Use moveBy () to move a window either horizontally, vertically, or both, by the specified amount in pixels.
Select Move from the pop-up menu. Press the left arrow or right arrow key until the program or app appears on the screen. A similar method swaps out the Shift key for the Windows key. It also relies on the snapping feature that snaps windows to the sides of your screen.
Step 1: Click the window or you can use the keyboard shortcut – Alt + Tab and let the window that you want to move active. Step 2: Then, press Alt + Spacebar and you can see a small menu Step 3: Press M (equal to selecting the Move option) and the mouse cursor will turn into a cross with arrows and move to the title bar of the window.
Again, use the Left or Right arrow keys on the keyboard to shift the off-screen window on the desktop fully. This method too can work if you’re still wondering how to move a window that is off-screen in Windows 11 if the window is still visible in the Taskbar.
I don't know how reliable this is, but to move the window relative to it's current position you can do this:
window.moveBy(250, 250); //moves 250px to the left and 250px down
http://www.w3schools.com/jsref/met_win_moveby.asp
To move the window to a certain part of the screen:
window.moveTo(0, 0); //moves to the top left corner of the screen (primary)
http://www.w3schools.com/jsref/met_win_moveto.asp
Courtesy of @Dan Herbert:
It should probably be noted that
window.moveTo(0,0)
will move to the top left corner of the primary screen. For people with multiple monitors you can also send negative coordinates to position on another monitor. You can check for a second monitor to move to withscreen.availLeft
. If it's negative, you can move a window that far onto the second monitor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With