Enhanced proxy of the Element.querySelectorAll function that let you specify if you want elements that are visible, or even that are in the viewport
Name | Type | Description | Status | Default |
---|---|---|---|---|
selector | { String } | The css selector to search | required | |
settings | { Object } | required |
Return { Array } The founded elements
// simple query
const elms = querySelectorAll('.a-cool-css-selector');
// get elements that are in the viewport
const elms = querySelectorAll('.a-cool-css-selector', {
inViewport : true
});
Author : Olivier Bossel [email protected] https://olivierbossel.com
Here's the list of available setting(s).
If we want only visible elements
Type : { Boolean }
Default : false
If we want only elements that are in the viewport
Type : { Boolean }
Default : false
The root node to start the query from
Type : { HTMLElement }
Default : document.body