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>
|
it is partially visible.</p>
|
||||||
<pre><code class="language-js">const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
<pre><code class="language-js">const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
||||||
const { top, left, bottom, right } = el.getBoundingClientRect();
|
const { top, left, bottom, right } = el.getBoundingClientRect();
|
||||||
|
const { innerHeight, innerWidth } = window;
|
||||||
return partiallyVisible
|
return partiallyVisible
|
||||||
? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
|
? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
|
||||||
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
||||||
|
|||||||
Reference in New Issue
Block a user