# IntersectionObserver.relativeToViewport

Call IntersectionObserver.relativeToViewport(object margins) to specify the page display area as one of the reference areas.

##  Support

This API only supports gadget calls, and the corresponding client version support is as follows.

App capability | Android | iOS | PC | Harmony | Preview
---|---|---|---|---|---
Gadget | V2.3.0+ | V2.3.0+ | V2.3.0+ | V7.35.0+ | Preview
Web app | **✕** | **✕** | **X** | **✕** | /

##  Input

Name | Data type | Required | Default value | Description
---|---|---|---|---
margins | object | Yes | \- | Margins for growing (or shrinking) the reference area.
&emsp;<br>∟<br>&nbsp;<br>left | number | No | 0 | Left margin of the area.
&emsp;<br>∟<br>&nbsp;<br>right | number | No | 0 | Right margin of the area.
&emsp;<br>∟<br>&nbsp;<br>top | number | No | 0 | Top margin of the area.
&emsp;<br>∟<br>&nbsp;<br>bottom | number | No | 0 | Bottom margin of the area.

##  Output
None

##  Sample code

```js
tt.createIntersectionObserver(this, {
    selectAll: true
})
.relativeToViewport({top:10})
```

