{"_id":"withinviewport","_rev":"11-26f086b30a2d2291479e7d4adfc59058","name":"withinviewport","description":"Determine whether an element is completely within the browser viewport","dist-tags":{"latest":"3.0.1"},"versions":{"0.1.0":{"name":"withinviewport","version":"0.1.0","description":"Determine whether an element is completely within the browser viewport","main":"withinviewport.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/patik/within-viewport.git"},"keywords":["within-viewport","browser","detect","event","infinite-scroll","scroll","view","viewport","window"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"http://patik.com"},"license":"MIT","bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"http://patik.github.io/within-viewport","gitHead":"23c5bdd893cded4b4c1d8a0754685a8a70d2e757","_id":"withinviewport@0.1.0","_shasum":"e68d18f425cea34817cbbbd3c27b0b0201f1516f","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.12.0","_npmUser":{"name":"patik","email":"craig@patik.com"},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"dist":{"shasum":"e68d18f425cea34817cbbbd3c27b0b0201f1516f","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-0.1.0.tgz","integrity":"sha512-aU+msIgkfi4QYKBpU6iHBm/jj9PA/TW9IhuPtwE5NgAd2y/3csrJ2T1zd2WxbK9i7XR70bp76clnA3LqVWb0nw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiGvkQoFjGB+ZYoJmtISUp3NSTvIH0dC9xoKOehZMC4gIgT11GGtiTTkONu83V2jOk1DI4JK1WuY+EtnrYUWZpwSY="}]},"directories":{}},"1.0.0":{"name":"withinviewport","version":"1.0.0","description":"Determine whether an element is completely within the browser viewport","main":"withinviewport.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"keywords":["within-viewport","browser","detect","event","infinite-scroll","scroll","view","viewport","window"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"http://patik.com"},"license":"ISC","bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"http://patik.github.io/within-viewport","gitHead":"87e8223edcfdfe3e989d25108bc330b995db7422","_id":"withinviewport@1.0.0","_shasum":"5f089ebd614086ed3b65da348387bd07abaefa44","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.12.0","_npmUser":{"name":"patik","email":"craig@patik.com"},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"dist":{"shasum":"5f089ebd614086ed3b65da348387bd07abaefa44","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-1.0.0.tgz","integrity":"sha512-cogKNQLRAat07iHfL6yQMJaFg11VwodUeIzmjjhfcmx4XWGwfljZYXUdUG92IzflDoafIZZ9cXDZ5GqQcR8HbQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEWeTMeJ6P628DqvyNseKUbNZ06KhnAYnY+zY0QBv/HAAiBoTE/U4gopULcgjp+RQQhxjxFxxaYcPENCnQpWnpmWyw=="}]},"directories":{}},"2.0.0":{"name":"withinviewport","version":"2.0.0","description":"Determine whether an element is completely within the browser viewport","main":"withinviewport.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"keywords":["within-viewport","browser","detect","event","infinite-scroll","scroll","view","viewport","window"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"http://patik.com"},"license":"ISC","bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"http://patik.github.io/within-viewport","gitHead":"84d79ef7c7fa6277874cfb173c6480f654807ca6","_id":"withinviewport@2.0.0","_shasum":"5df1468b087832812dfba0a793c2be4e96b2da85","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"patik","email":"craig@patik.com"},"dist":{"shasum":"5df1468b087832812dfba0a793c2be4e96b2da85","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-2.0.0.tgz","integrity":"sha512-TcmTCH7Rct0Sz28lJDHoNx+5PmWF/JQVHlsDlAdg5Q1fcWPMozq+qAIYWnF1Hl6WLSaQpugyt8vL0KdRwmRt1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCM4DTJ84DBLXvSTuhUSSbvdLBxG0ZAxhhwvqvY0NcfWAIgTR6Z+UVd7b730/Kke68iFlVu5XVuxM6Im6MLGx0sz+8="}]},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/withinviewport-2.0.0.tgz_1482181560069_0.8456325915176421"},"directories":{}},"2.1.0":{"name":"withinviewport","version":"2.1.0","description":"Determine whether an element is completely within the browser viewport","main":"withinviewport.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"keywords":["within-viewport","browser","detect","event","infinite-scroll","scroll","view","viewport","window"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"http://patik.com"},"license":"ISC","bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"http://patik.github.io/within-viewport","gitHead":"51967bbc345b00243442648cd7c636dc44771178","_id":"withinviewport@2.1.0","_shasum":"92581528152bfbc51f14291f661402b921638fd3","_from":".","_npmVersion":"3.5.2","_nodeVersion":"6.9.4","_npmUser":{"name":"patik","email":"craig@patik.com"},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"dist":{"shasum":"92581528152bfbc51f14291f661402b921638fd3","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-2.1.0.tgz","fileCount":6,"unpackedSize":21141,"integrity":"sha512-6M4DWvGKMHCN1XAU8sBWzozqo3N6Edtv0zk2rO6dW7CPCWBsW1Shiwy7YTSdW6g+4I5Z/7ZFUkCtgN4YxZRNww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWKXBCmJsI92dDy2rSGGtowhwEHe+pEvBC5rDVKj6SggIgFZR9wh+t4bYdIoFEVFo0yTkjSFqp+h3YdBt+kUR7yt8="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/withinviewport_2.1.0_1532873428292_0.45015516755680385"},"_hasShrinkwrap":false},"2.1.2":{"name":"withinviewport","version":"2.1.2","description":"Determine whether an element is completely within the browser viewport","main":"withinviewport.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"keywords":["within-viewport","browser","detect","event","infinite-scroll","scroll","view","viewport","window"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"http://patik.com"},"license":"ISC","bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"http://patik.github.io/within-viewport","gitHead":"93ddfdc682fd31e628f971943f30b5ee73280bdc","_id":"withinviewport@2.1.2","_nodeVersion":"11.15.0","_npmVersion":"6.7.0","_npmUser":{"name":"patik","email":"craig@patik.com"},"dist":{"integrity":"sha512-bOZt20QiBkAroXwCAVnb+ajYNPAzVrTKCKuVAuWtLbXlOk3e5cAS5diZMWhYP4Cpyq3GS47jk+fsb5tQqhIxtg==","shasum":"7b09a5e566be15e51211ebfd4afb9aad6bc5dc12","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-2.1.2.tgz","fileCount":5,"unpackedSize":21472,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdVwp4CRA9TVsSAnZWagAAc70P/j9fdMtusZZKQdoI9Q9X\n5JkBYeDGfnq9BxiLY5HmRR9tni61xtHbjnhkEMpOfpM280dNFrDDFD1JDlIc\nzR122PRMuhw/VfcCwv3RXWlQREYz6c+LHk54oLmEqkr0WGc5sz8yDuPsBhUU\n8UGmKgVaUk4xiR9hS0PfYqxa7lJ7FF/8s0N2rJmx+Xg0L5JCjTccQzq+u3QT\nl09KNSfjzH30j4YsyK+8g7dm+dceVWUol9L7zyyUR3kCY6lPDU6bwM12kxD7\nuJ0dA8iP9A11tIew3JcsaUXWLsZ455tKyJX0PJQljVd6msYZ5zsqjRSTUSWM\ncXUE9lWyXJ5C00PJf4wv7nq+0vrurl47lY4g+fnQprPG6SPrwU7awF9oCxI7\n80rgla4+n1nE/DS7HuZefWeSBHMDd7AkAdVdWqKnCes+UGI3v6bXxMITBHC8\nxLELjtI/dZNaS0hGDBUx8p71ZlocpENb7qXqT7r6IzlLQ0n6UWRVkVIlIo94\nyG3l3ufC1nYW3lPyHY3QEfPO2b0ecGrLNWe6jTvtzgMOWdISifLwWbJpvou+\n4ogNV6zdmn3e1lX3V3NTepUcBvUvpK3V4bMlY4scbo6hrAdE9sWB7u2Wgi+b\n+q4rFAziInrc4RQ7+Fa36Z4hhqF51IEedj6QOPHoioaQS2nMpI3EjRDWMoGZ\nlrhO\r\n=o2F8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8tJtEAy0ryi/nnruPUyO0NvK4IEDBRj438sx6TQkvSAIgA2p25vnXhoYhWgJ99hi4Cku8sCjsdNES05bKXkClCUw="}]},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/withinviewport_2.1.2_1565985399563_0.020422357257673163"},"_hasShrinkwrap":false},"3.0.0":{"name":"withinviewport","description":"Determine whether an element is completely within the browser viewport","version":"3.0.0","type":"module","repository":{"type":"git","url":"https://github.com/patik/within-viewport.git"},"devDependencies":{"@testing-library/dom":"^8.19.1","@testing-library/jest-dom":"^5.16.5","@types/lodash":"^4.14.191","eslint-config-prettier":"^8.6.0","eslint-plugin-cypress":"^2.12.1","eslint-plugin-jest-dom":"^4.0.3","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1"},"dependencies":{"lodash":"^4.17.21"},"bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"https://github.com/patik/within-viewport","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"rm -rf dist/* && yarn tsc --project ./tsconfig.export.json && cp ../README.md ./README.md && cp ../LICENSE ./LICENSE","clean":"git clean -fdx","cover":"yarn test --collectCoverage","typecheck":"tsc --noEmit","code-lint":"eslint --ext .ts --fix ./src/**/*.ts","lint":"yarn typecheck && yarn code-lint && yarn unused-exports","preversion":"yarn build && yarn cover","test":"yarn jest --coverage","unused-exports":"ts-prune -p ./tsconfig.json","cypress:open":"cypress open"},"keywords":["viewport","IntersectionObserver","window","DOM","visible","visibility","element","view","within-viewport","browser","detect","event","infinite-scroll","scroll"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"https://patik.com"},"license":"BSD-3-Clause","lint-staged":{"*.ts":"eslint --cache --cache-location .eslintcache --fix"},"engines":{"node":">=12.0"},"licenseText":"# BSD 3-Clause License\n\nCopyright (c) 2023, Craig Patik [(patik.com)](https://patik.com)\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","_id":"withinviewport@3.0.0","dist":{"shasum":"c32e29e76981e8933aa9218624174a4b5f87ab52","integrity":"sha512-OJYtiu0Zur4KuxnUsGQbzNbpCm58liWTRcNVCT1ePc/yIOe5RMDLo9Wf03pQzmwDaSYFjiRvfiGE3EhS3/0uFA==","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-3.0.0.tgz","fileCount":49,"unpackedSize":68116,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCH16G9l1ChmT7n/bjbQ6BEq1g3yj7y63urtRpJORFvS4CIQC9Thg+t6u8WLkClesTtV0BQ+gdSl7rjOujDW5i/oL/Wg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjzkRtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmppkQ/+MtuiZg5GKHTjUrQ87d4b9BmSzsweaNgWK+bcng4yTOvUZptz\r\naIUCeilq78clIMtbathMXQTZRZkqXb6AaRzjUhHfrO9sJqLhrgXn++ujoEAO\r\n5F5ckPvOaHiCEL3pwa2lLXIacOuxPuEwm4s3jwv42qK1i8mkuP/cB8EMRNtr\r\nXmOlIMsrT5+lBRrx/LpVgnl8RApaRYiZTcy0/eoTqpLacUjCaaVC5/0GZNqC\r\nYiIinXC3bzbAvvgCZQ5GrzDKGR034v9Q11Ygwi9T2SYk8Ty2teKLmOlIayyl\r\n/JQnW0r2HqApPGlFzxJYQnwp+bLI2UMDp8JkuD01C6cJLdIktvfiJ9f5NPAS\r\nVsnPL+jNzZlVa25QpMUT3nV4J9LF8UZUdhJgjPzs5WpzUShJN00MbgxdFEyF\r\nuzZa5s9xgeo888Ku5tmD0KKdczyLkNWyYDV+mayUl6E57dUaVO/bLloeljdp\r\nlQ/aVCP0CunieDNVFmps4TBZ6dXWWj5osJeoUEH2yJOaHKu6M5zrY/JhAZbk\r\ne2uHTCRLyJs5fcfBHOipxurzm2V0LWr8YORYBw8VBJnTYFG6ClyjoKWuDENS\r\nHwoefN5XfkHitq7OPBgNKgdmitdM9Gg5fdAauBZWpLLKsfPYYLjc1Gzf/tW5\r\nXKN8CQD9xyZrof3j3gRE13UBxiKbjQ/LXKM=\r\n=z2JT\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"patik","email":"craig@patik.com"},"directories":{},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/withinviewport_3.0.0_1674462317509_0.06258332014895784"},"_hasShrinkwrap":false},"3.0.1":{"name":"withinviewport","description":"Determine whether an element is completely within the browser viewport","version":"3.0.1","type":"module","repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"devDependencies":{"@testing-library/dom":"^9.3.1","@testing-library/jest-dom":"^5.16.5","eslint-config-prettier":"^8.8.0","eslint-plugin-cypress":"^2.13.3","eslint-plugin-jest-dom":"^5.0.1","jest":"^29.6.0","jest-environment-jsdom":"^29.6.0"},"dependencies":{},"bugs":{"url":"https://github.com/patik/within-viewport/issues"},"homepage":"https://github.com/patik/within-viewport","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"types":"./dist/cjs/index.d.ts","main":"./dist/cjs/index.js","module":"./dist/esm/index.js","scripts":{"build":"yarn build-commonjs && yarn build-esm && yarn addcjstype && yarn addesmtype","build-commonjs":"shx rm -rf dist/cjs/* && yarn tsc --project ./tsconfig.cjs.json && shx cp ../README.md ./README.md && shx cp ../LICENSE ./LICENSE","build-esm":"shx rm -rf dist/esm/* && yarn tsc --project ./tsconfig.esm.json && shx cp ../README.md ./README.md && shx cp ../LICENSE ./LICENSE","clean":"git clean -fdx","cover":"yarn test --collectCoverage","typecheck":"tsc --noEmit","code-lint":"eslint --ext .ts --fix ./src/**/*.ts","lint":"yarn typecheck && yarn run code-lint && yarn unused-exports","preversion":"yarn build && yarn cover","test":"yarn jest --coverage","unused-exports":"unimported --no-cache","cypress:open":"cypress open","addcjstype":"shx cat >dist/cjs/package.json <<!EOF\n{\n    \"type\": \"commonjs\"\n}\n!EOF","addesmtype":"shx cat >dist/esm/package.json <<!EOF\n{\n    \"type\": \"module\"\n}\n!EOF"},"keywords":["viewport","IntersectionObserver","window","DOM","visible","visibility","element","view","within-viewport","browser","detect","event","infinite-scroll","scroll"],"author":{"name":"Craig Patik","email":"craig@patik.com","url":"https://patik.com"},"license":"BSD-3-Clause","lint-staged":{"*.ts":"eslint --cache --cache-location .eslintcache --fix"},"engines":{"node":">=12.0"},"gitHead":"511231a6d78f3ff88d6da9cc39dbe7c3bfe56918","_id":"withinviewport@3.0.1","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-NnBaZu9BzoBB9yfLtE7w+NQj6DT2746UuMJ8DC5nt8Z7jHfofUYITOo/Gr7iw1oymurIJmoe6Z9VCU94lbvhYQ==","shasum":"7026d6c97214e90d01dfa8d748f13381a17c92fd","tarball":"https://registry.npmjs.org/withinviewport/-/withinviewport-3.0.1.tgz","fileCount":93,"unpackedSize":126872,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDML/TZFBwIECus+KYyh7ynq2UgsJ1ZXNSD+akDSDfS8AIhANnjrMlN5bRaKTN6pZdwTvkapupiceVPE7WSPOaVnO1w"}]},"_npmUser":{"name":"patik","email":"craig@patik.com"},"directories":{},"maintainers":[{"name":"patik","email":"craig@patik.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/withinviewport_3.0.1_1688636814849_0.7843292549493628"},"_hasShrinkwrap":false}},"readme":"# Within Viewport\n\n***Determine whether elements are completely within the viewport***\n\nIncludes:\n\n- The synchronous function, `withinViewport()`\n  - Continues to support [legacy browsers](#browser-support)\n- The asynchronous, promise-based function, `withinViewportAsync()`\n  - More performant, but only for [modern browsers](https://caniuse.com/intersectionobserver) (e.g. post IE 11)\n- Optional jQuery plugin with handy selectors and shorthand methods\n- TypeScript support\n- Support for CommonJS and ESM modules\n\nAll of the above offer the same features.\n\n## Install\n\n```sh\nyarn add withinviewport\n```\n\nor\n\n```sh\nnpm install withinviewport\n```\n\nAnd then in your JavaScript or TypeScript:\n\n```js\nimport { withinViewport /* or withinViewportAsync */ } from 'withinviewport'\n```\n\nBoth CommonJS and ESM modules are provided.\n\n## Usage\n\n### Basic\n\n```js\n// Returns true if the element is entirely within view of the window\nconst elem = document.getElementById('#myElement')\n\nwithinViewport(elem) // returns a boolean\nwithinViewportAsync(elem) // returns a Promise<boolean>\n```\n\n### Advanced\n\nAll options work the same for both the synchronous and asynchronous functions.\n\n```js\n// Test against only some sides of the window for faster performance\nwithinViewport(elem, { left: 'ignore' })\n```\n\n```js\n// Pick another element to act as the viewport (instead of `window`)\nwithinViewport(elem, { container: document.getElementById('myElem') })\n```\n\n```js\n// Define your own viewport crop by specifying thresholds for each side\n// Example: element is at least 12px inside the top and right of the viewport\nwithinViewport(elem, { top: 12, right: 12 })\n```\n\nFor more options, see [Options](#options) section below.\n\n### Shorthand notation\n\n```js\n// This will only check the bottom and right of the viewport, ignoring the top and left\nwithinViewport(elem, 'bottom right')\nleft(elem)\n```\n\n## jQuery plugin\n\nBe sure to include the full version of the script as well\n\n```js\n<script src=\"withinviewport.js\"></script>\n<script src=\"jquery.js\"></script>\n<script src=\"jquery.withinviewport.js\"></script>\n```\n\n### Basic usage\n\n```js\n// Returns true if the element is entirely within the viewport\n$('#myElement').is(':within-viewport')\n```\n\n```js\n// Returns a jQuery object of all <div>s that are within the viewport\n$('div').withinViewport()\n```\n\n### Advanced usage\n\nThere are shorthand selectors and methods for testing against only one edge of the viewport.\n\n```js\n// Returns true if the element is within the left edge of the viewport\n// Also works with 'top', 'right', and 'bottom'\n$('#myElement').is(':within-viewport-left')\n```\n\n```js\n// Returns a jQuery collection of all <div>s within the left edge of the viewport\n$('div').withinViewportLeft()\n```\n\n```js\n// Same as above, but only elements that are at least 12px inside the left edge\n$('div').withinViewportLeft({ left: 12 })\n```\n\nThese shortcuts will result in slightly better performance if you're testing hundreds or thousands of elements.\n\n#### Live updating\n\nIf you're looking to keep tabs on elements' whereabouts at all times, you can bind to the `window`'s `resize` and `scroll` events. However, for performance reasons, it's strongly recommended to [throttle](https://lodash.com/docs/#throttle) your event listener or use something like [James Padolsey's `scrollStop` event](https://web.archive.org/web/20210824132834/https://j11y.io/javascript/special-scroll-events-for-jquery/). Firing on every `window.scroll` event will [bring your UI to its knees](https://ejohn.org/blog/learning-from-twitter/).\n\n```js\n$(window).on('resize scrollStop', _.throttle(function() {\n    // Your code here...\n\n    // Example:\n    $('div')\n        // Momentarily declare all divs out of the viewport...\n        .removeClass('within-viewport')\n        // Then filter them to reveal which ones are still within it\n        .filter(':within-viewport')\n            .addClass('within-viewport')\n}, 100));\n```\n\n## Options\n\nAll options work the same across the synchronous and asynchronous functions and the jQuery plugin.\n\n### Custom viewport element\n\nIf you want to test whether an element is within a scrollable parent element (e.g. which has `overflow: auto` or `scroll`), assign the parent element to the `container` property:\n\n```js\nwithinViewport(elem, {\n    container: document.querySelector('.parent-element')\n})\n```\n\n### Custom boundaries\n\nFor example, a fixed header with a height of 100px that spans the entire width of the page effectively lowers the viewport by 100px from the top edge of the browser window:\n\n```js\nwithinViewport(elem, { top: 100 })\n```\n\nIf you only care about some edges of the viewport, you can specify them to improve performance:\n\n```js\nwithinViewport(elem, 'left bottom')\n```\n\nYou can also combine optins:\n\n```js\nwithinViewport(elem, { left: 40, container: myDiv })\n$('div').withinViewport({ right: -70, top: 'ignore' })\n```\n\nYou can specify *negative threshold values* to allow elements to reside outside the viewport.\n\n## Migrating from v2 to v3\n\nThe `sides` option has been deprecated. The following calls are equivalent:\n\n```js\n// 2.x: specifying which sides to *monitor*\nwithinViewport(elem, { sides: ['left', 'right']})\n\n// 3.x: specifying which sides to *ignore*\nwithinViewport(elem, { top: 'ignore', bottom: 'ignore' })\n```\n\n## Browser Support\n\nFor the synchronous functions:\n\n- IE 7(?) and higher\n- All the others except Opera Mini\n  - Tested in the latest stable Chrome, Firefox, Safari, and Edge\n\nThe asynchronous functions work in any browser that supports promises and [IntersectionObserver](https://caniuse.com/intersectionobserver).\n\nAll functions (both versions) are transpiled to ES5.\n\n## Credit\n\nWithin Viewport is inspired by these similar utilities which only reflect whether an element is at least partially in view:\n\n- Remy Sharp's [Element 'in view' Event Plugin](https://remysharp.com/2009/01/26/element-in-view-event-plugin/)\n- Mike Tuupola's [Viewport Selectors for jQuery](https://github.com/tuupola/jquery_viewport)\n\n## License\n\nHave fun with it &mdash; [BSD-3-Clause](https://choosealicense.com/licenses/bsd-3-clause/). See included [LICENSE](LICENSE) file.\n\n## Author\n\n[Craig Patik](https://patik.com)\n","maintainers":[{"name":"patik","email":"craig@patik.com"}],"time":{"modified":"2023-07-06T09:46:55.137Z","created":"2015-04-10T15:17:27.268Z","0.1.0":"2015-04-10T15:17:27.268Z","1.0.0":"2015-08-02T22:51:30.510Z","2.0.0":"2016-12-19T21:06:00.792Z","2.1.0":"2018-07-29T14:10:28.385Z","2.1.2":"2019-08-16T19:56:39.705Z","3.0.0":"2023-01-23T08:25:17.705Z","3.0.1":"2023-07-06T09:46:55.023Z"},"homepage":"https://github.com/patik/within-viewport","keywords":["viewport","IntersectionObserver","window","DOM","visible","visibility","element","view","within-viewport","browser","detect","event","infinite-scroll","scroll"],"repository":{"type":"git","url":"git+https://github.com/patik/within-viewport.git"},"author":{"name":"Craig Patik","email":"craig@patik.com","url":"https://patik.com"},"bugs":{"url":"https://github.com/patik/within-viewport/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md","users":{"fabrianibrahim":true}}