add missing line of code to elementIsVisibleInViewport
This commit is contained in:
@ -878,6 +878,7 @@ it is partially visible.
|
|||||||
```js
|
```js
|
||||||
const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
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))
|
||||||
@ -1694,7 +1695,6 @@ orderby(users, ['name', 'age']) -> [{name: 'barney', age: 34}, {name: 'barney',
|
|||||||
*/
|
*/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[⬆ back to top](#table-of-contents)
|
[⬆ back to top](#table-of-contents)
|
||||||
|
|
||||||
### select
|
### select
|
||||||
|
|||||||
@ -10,6 +10,7 @@ it is partially visible.
|
|||||||
```js
|
```js
|
||||||
const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
|
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))
|
||||||
|
|||||||
@ -23,4 +23,3 @@ orderby(users, ['name', 'age'], ['asc', 'desc']) -> [{name: 'barney', age: 36},
|
|||||||
orderby(users, ['name', 'age']) -> [{name: 'barney', age: 34}, {name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}]
|
orderby(users, ['name', 'age']) -> [{name: 'barney', age: 34}, {name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}]
|
||||||
*/
|
*/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user