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?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
From a quick google search: Moving windows
You're looking for Window.moveBy and window.moveTo
I remember that video too, you select your hometown and whatnot? I quite liked that.
Since your links contain anchors, "#", when you click on the links it will move the page back to the top. Try replacing the href with something like:
This will prevent anything within the href from executing.
You move a displayed object's position by changing its top and left margins, which, together, are the coordinates of its top left corner. If you know the absolute coordinates of the target position, you can change the margins and the object will move to that spot.
If you don't know the absolute target position, but only know two relative deltas (i.e., move the window up 5 pixels and right 10 pixels), you can read the object's top and left margins, increment those by the appropriate distances, and set the margins from that.
Margins are part of the style of the object, so you'd say something like:
for a positioned object.
I don't know how reliable this is, but to move the window relative to it's current position you can do this:
http://www.w3schools.com/jsref/met_win_moveby.asp
To move the window to a certain part of the screen:
http://www.w3schools.com/jsref/met_win_moveto.asp
Courtesy of @Dan Herbert: