getElementSize

Get the width and height for an DOM-element based given selector.

Usage

1
client.getElementSize(selector).then(callback);

Parameters

Param Type Details
selector String element with requested size

Example

getElementSize.js
1
2
3
4
5
6
7
8
9
10
client
.getElementSize('.header-logo-wordmark').then(function(size) {
console.log(size) // outputs: { width: 100, height: 200 }
})
.getElementSize('.header-logo-wordmark', 'width').then(function(width) {
console.log(width) // outputs: 100
})
.getElementSize('.header-logo-wordmark', 'height').then(function(height) {
console.log(height) // outputs: 200
});

Uses