DOM.inLayoutViewport()

<static> inLayoutViewport(element, cushion) → {boolean}

Tests if the given DOM element is within the Layout viewport.

The optional cushion parameter allows you to specify a distance.

inLayoutViewport(element, 100) is true if the element is in the viewport or 100px near it.
inLayoutViewport(element, -100) is true if the element is in the viewport or at least 100px near it.

Parameters
Name Type Argument Description
element DOMElement | Object

The DOM element to check. If no element is given it defaults to the Phaser game canvas.

cushion number <optional>

The cushion allows you to specify a distance within which the element must be within the viewport.

Returns
boolean -

True if the element is within the viewport, or within cushion distance from it.

Source code: utils/DOM.js (Line 128)
doc_phaser
2017-02-14 10:45:01
Comments
Leave a Comment

Please login to continue.