Travis build: 117
This commit is contained in:
@ -596,6 +596,7 @@ Omit the second argument to determine if the element is entirely visible, or spe
|
||||
it is partially visible.</p>
|
||||
<pre><code class="language-js">const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
||||
const { top, left, bottom, right } = el.getBoundingClientRect();
|
||||
const { innerHeight, innerWidth } = window;
|
||||
return partiallyVisible
|
||||
? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
|
||||
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
||||
|
||||
Reference in New Issue
Block a user