Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.util.isElementInView.js.map Maven / Gradle / Ivy
{"version":3,"file":"isElementInView.js","sourceRoot":"","sources":["../../src/util/isElementInView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,EAAe,EAAE,EAAE;IAC3C,MAAM,IAAI,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;IAExC,OAAO,CACN,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;WAC3B,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC;WAC5E,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,CAC7E,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["/**\n * Determines if the element is within the viewport.\n * @param el {HTMLElement}\n */\nconst isElementInView = (el: HTMLElement) => {\n\tconst rect = el.getBoundingClientRect();\n\n\treturn (\n\t\trect.top >= 0 && rect.left >= 0\n\t\t\t&& rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)\n\t\t\t&& rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n\t);\n};\n\nexport default isElementInView;\n"]}