ui.root.onResize
Registers a callback that's fired when the script starts and whenever the browser window size changes. It will be passed an object with boolean fields "is_mobile", "is_tablet", "is_desktop", "is_portrait" and "is_landscape", and numeric fields "width" and "height".
These fields indicate whether a user's device is mobile, tablet or desktop, the device orientation (portrait or landscape), and the width and height of the window in pixels. See the Width and Height (dp) section of device metrics at https://material.io/resources/devices/.
Usage | Returns |
---|
ui.root.onResize(callback) | |
Argument | Type | Details |
---|
callback | Function | The callback to fire after the window has been resized. The callback is passed an object with the information of the device. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["Triggers a provided function when the webpage loads or the browser window is resized."],["Provides details about the device used, such as whether it is a mobile, tablet, or desktop, its orientation (portrait or landscape), and the window's dimensions in pixels."],["Utilizes boolean fields (\"is_mobile\", \"is_tablet\", \"is_desktop\", \"is_portrait\", \"is_landscape\") and numeric fields (\"width\", \"height\") within a passed object to convey device information."],["Can be implemented using `ui.root.onResize(callback)`, where `callback` represents the function to be executed."]]],[]]