Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > style
utils.style namespace
Functions
Function |
Description |
getBorderBox(element) |
Gets the computed border widths (on all sides) in pixels Copied from Closure's goog.style.getBorderBox |
getComputedStyle(element, property) |
Retrieves a computed style value of a node. It returns empty string if the property requested is an SVG one and it has not been explicitly set (firefox and webkit). Copied from Closure's goog.style.getComputedStyle |
getContainerOffsetToScrollInto(element, container, opt_center) |
Calculate the scroll position of container with the minimum amount so that the content and the borders of the given element become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible. Copied from Closure's goog.style.getContainerOffsetToScrollInto |
getPageOffset(el) |
Returns a Coordinate object relative to the top-left of the HTML document. Similar to Closure's goog.style.getPageOffset |
getSize(element) |
Gets the height and width of an element. Similar to Closure's goog.style.getSize |
getViewportPageOffset() |
Calculates the viewport coordinates relative to the document. Similar to Closure's goog.style.getViewportPageOffset |
scrollIntoContainerView(element, container, opt_center) |
Changes the scroll position of container with the minimum amount so that the content and the borders of the given element become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible. Copied from Closure's goog.style.scrollIntoContainerView |
Variables
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 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eBlockly.utils.style\u003c/code\u003e namespace provides functions for calculating and manipulating element positions and styles within a web page.\u003c/p\u003e\n"],["\u003cp\u003eThese functions include methods for getting element size, border, computed styles, and page offset, among others.\u003c/p\u003e\n"],["\u003cp\u003eMany of these functions are adapted from Closure's goog.style library, offering similar functionality.\u003c/p\u003e\n"],["\u003cp\u003eThe namespace aims to help with tasks like scrolling elements into view and determining their location on the page.\u003c/p\u003e\n"],["\u003cp\u003eAdditionally, there is a TEST_ONLY variable within the namespace for testing purposes.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [utils](./blockly.utils_namespace.md) \\\u003e [style](./blockly.utils_namespace.style_namespace.md)\n\nutils.style namespace\n---------------------\n\nFunctions\n---------\n\n| Function | Description |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getBorderBox(element)](./blockly.utils_namespace.style_namespace.getborderbox_1_function.md) | Gets the computed border widths (on all sides) in pixels Copied from Closure's goog.style.getBorderBox |\n| [getComputedStyle(element, property)](./blockly.utils_namespace.style_namespace.getcomputedstyle_1_function.md) | Retrieves a computed style value of a node. It returns empty string if the property requested is an SVG one and it has not been explicitly set (firefox and webkit). Copied from Closure's goog.style.getComputedStyle |\n| [getContainerOffsetToScrollInto(element, container, opt_center)](./blockly.utils_namespace.style_namespace.getcontaineroffsettoscrollinto_1_function.md) | Calculate the scroll position of `container` with the minimum amount so that the content and the borders of the given `element` become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible. Copied from Closure's goog.style.getContainerOffsetToScrollInto |\n| [getPageOffset(el)](./blockly.utils_namespace.style_namespace.getpageoffset_1_function.md) | Returns a Coordinate object relative to the top-left of the HTML document. Similar to Closure's goog.style.getPageOffset |\n| [getSize(element)](./blockly.utils_namespace.style_namespace.getsize_1_function.md) | Gets the height and width of an element. Similar to Closure's goog.style.getSize |\n| [getViewportPageOffset()](./blockly.utils_namespace.style_namespace.getviewportpageoffset_1_function.md) | Calculates the viewport coordinates relative to the document. Similar to Closure's goog.style.getViewportPageOffset |\n| [scrollIntoContainerView(element, container, opt_center)](./blockly.utils_namespace.style_namespace.scrollintocontainerview_1_function.md) | Changes the scroll position of `container` with the minimum amount so that the content and the borders of the given `element` become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible. Copied from Closure's goog.style.scrollIntoContainerView |\n\nVariables\n---------\n\n| Variable | Description |\n|------------------------------------------------------------------------------|-------------|\n| [TEST_ONLY](./blockly.utils_namespace.style_namespace.test_only_variable.md) | |"]]