- Source:
Methods
isInViewport(element, mustBeFullyInsideopt, nullable) → {Boolean}
Returns if the current element is visible in the window's viewport at the moment.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
element |
HTMLElement | the element to check |
||
mustBeFullyInside |
Boolean |
<optional> <nullable> |
false | defines if the element has to be fully enclosed in the viewport, default is false |
- Source:
Returns:
true if in viewport
- Type
- Boolean
Example
if( isInViewport(document.querySelector('div.moving'), true) ){
...
}