getLocationInView

Determine an element’s location on the screen once it has been scrolled into view.

Usage

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

Parameters

Param Type Details
selector String element with requested position offset

Example

getLocationInView.js
1
2
3
4
5
6
7
8
9
10
11
client
.url('http://github.com')
.getLocationInView('.header-logo-wordmark').then(function(location) {
console.log(location); // outputs: { x: 100, y: 200 }
})
.getLocationInView('.header-logo-wordmark', 'x').then(function(location) {
console.log(location); // outputs: 100
})
.getLocationInView('.header-logo-wordmark', 'y').then(function(location) {
console.log(location); // outputs: 200
}):

Uses