Modern JavaScript: Develop and Design (Richard Stout's Library) by Larry Ullman
Author:Larry Ullman
Language: eng
Format: mobi
Publisher: Peachpit Press
Published: 2012-01-17T23:00:00+00:00
Figure 9.7. How windows are positioned relative to the entire screen.
The innerHeight and innerWidth properties reflect the size of the content within the window, including scroll bars, when present. The outerHeight and outerWidth properties reflect the size of the entire browser window (see Figure 9.6). For older versions of IE, which only started supporting these properties in version 9, you need to use document.body.clientHeight and document.body.clientWidth. You cannot change the size of the window using any of these properties (except in Firefox), but they can be used as the basis for dynamically changing your layout, if need be. For example, if a window dimension is particularly small, you could have JavaScript use smaller images. If a window’s width is narrow, perhaps JavaScript disables a sidebar.
If, for some very, very, very good reason you need to move the browser window, you would call the moveTo() method of the window object. It takes X and Y pixel values for its arguments, where 0,0 is the top-left corner of the screen (see Figure 9.7). The following code moves the window to place its top-left corner positioned 100 pixels to the right of the left side of the screen and 200 pixels down from the top of the screen:
window.moveTo(100,200);
Whereas moveTo() moves the window to a specific location, moveBy() moves a window relative to its current location. It, too, takes X and Y values, in terms of the number of pixels to move the window:
window.moveBy(25, 50);
Positive numbers move the window to the right and down; negative numbers move the window up and to the left. That code moves the window 25 pixels to the right and 50 pixels down from its current location. Note that you will not be allowed to move the window beyond the confines of the screen.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8298)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6847)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6580)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6450)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6414)
Kotlin in Action by Dmitry Jemerov(5064)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4317)
Functional Programming in JavaScript by Mantyla Dan(4038)
Solidity Programming Essentials by Ritesh Modi(4008)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3800)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3743)
The Ultimate iOS Interview Playbook by Avi Tsadok(3716)
