cf2:dom.Element#Dimensions

Purpose

Allows authors to fix device specific issues related to the screen dimensions.

Exported Features

cf2:dom.Element#Dimensions

Imported Features

cf2:dom.Element - enhances

JavaScript

This component adds the following methods to the V$.dom.Element's prototype object.

v_getSize()

Returns the size of the element in pixels. The returned dimensions include the area covered by the border, padding and the contents of the element.

v_getInnerSize()

Returns the inner size of the element in pixels. The returned dimensions include the area covered by the contents of the element, but does not include the area covered by the padding and border.

The screen dimensions are stored as a Map with two properties: w for the width, and h for the height. Both properties are specified in pixels.

Example

var e = V$E("box");
var size = e.v_getSize();
var width = size.w;
var height = size.h;
size = e.v_getInnerSize();
width = size.w;
height = size.h;

Related topics