update snippets 32-47
This commit is contained in:
committed by
Agamemnon Zorbas
parent
3994e12792
commit
0001ff4dcb
@ -16,7 +16,10 @@ const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
||||
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
||||
: top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
|
||||
};
|
||||
// e.g. 100x100 viewport and a 10x10px element at position {top: -1, left: 0, bottom: 9, right: 10}
|
||||
// elementIsVisibleInViewport(el) -> false (not fully visible)
|
||||
// elementIsVisibleInViewport(el, true) -> true (partially visible)
|
||||
```
|
||||
|
||||
```js
|
||||
// e.g. 100x100 viewport and a 10x10px element at position {top: -1, left: 0, bottom: 9, right: 10}
|
||||
elementIsVisibleInViewport(el) -> false // (not fully visible)
|
||||
elementIsVisibleInViewport(el, true) -> true // (partially visible)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user