Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isElementInViewport.js 649B

1234567891011121314
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. function isElementInViewport(elem) {
  4. if (!elem.getBoundingClientRect) {
  5. return false;
  6. }
  7. const rect = elem.getBoundingClientRect();
  8. const windowHeight = (window.innerHeight || document.documentElement.clientHeight);
  9. const windowWidth = (window.innerWidth || document.documentElement.clientWidth);
  10. const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) > 0);
  11. const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) > 0);
  12. return (vertInView && horInView);
  13. }
  14. exports.default = isElementInViewport;