{"id":13341573,"url":"https://github.com/AlStar01/lazy-loading-img","last_synced_at":"2025-03-11T22:31:09.247Z","repository":{"id":143885277,"uuid":"109399848","full_name":"AlStar01/lazy-loading-img","owner":"AlStar01","description":"Web component to lazy load images using Intersection Observer","archived":false,"fork":false,"pushed_at":"2017-11-06T01:07:28.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T07:48:22.797Z","etag":null,"topics":["stenciljs","tsx","typescript","web-components"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlStar01.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-03T13:39:51.000Z","updated_at":"2023-03-05T05:14:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"b3890a39-72d0-435e-981e-b955320509b5","html_url":"https://github.com/AlStar01/lazy-loading-img","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlStar01%2Flazy-loading-img","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlStar01%2Flazy-loading-img/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlStar01%2Flazy-loading-img/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlStar01%2Flazy-loading-img/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlStar01","download_url":"https://codeload.github.com/AlStar01/lazy-loading-img/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125111,"owners_count":20240263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stenciljs","tsx","typescript","web-components"],"created_at":"2024-07-29T19:25:38.890Z","updated_at":"2025-03-11T22:31:09.241Z","avatar_url":"https://github.com/AlStar01.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lazy Loading Image\n\nWeb component to lazy load images using Intersection Observer.\n\n## Getting Started\n\n```bash\nnpm install\nnpm start\n```\n\nTo watch for file changes during develop, run:\n\n```bash\nnpm run dev\n```\n\nTo build the component for production, run:\n\n```bash\nnpm run build\n```\n\nTo run the unit tests for the components, run:\n\n```bash\nnpm test\n```\n\n## Using this component\n\n### Polyfill\n\nNot all browsers natively support [IntersectionObserver](https://caniuse.com/#search=IntersectionObserver). This can be supported with a polyfill such as [Polyfill.io](https://polyfill.io).\n\n```html\n\u003cscript src=\"https://cdn.polyfill.io/v2/polyfill.js?features=IntersectionObserver,IntersectionObserverEntry\"\u003e\u003c/script\u003e\n```\n\n### Script tag\n\n- Put a script tag similar to this `\u003cscript src=\"https://unpkg.com/lazy-loading-img@latest/dist/lazyloadingimg.js\"\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### Node Modules\n- Run `npm install lazy-loading-img --save`\n- Put a script tag similar to this `\u003cscript src=\"node_modules/lazy-loading-img/dist/lazyloadingimg.js\"\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### In a stencil-starter app\n- Run `npm install lazy-loading-img --save`\n- Add `{ name: 'lazy-loading-img' }` to your [collections](https://github.com/ionic-team/stencil-starter/blob/master/stencil.config.js#L5)\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### HTML\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n  \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"\u003e\n  \u003ctitle\u003eLazy Loading Image Example\u003c/title\u003e\n\n  \u003c!-- Intersection Observer Polyfill --\u003e\n  \u003cscript src=\"https://cdn.polyfill.io/v2/polyfill.js?features=IntersectionObserver,IntersectionObserverEntry\"\u003e\u003c/script\u003e\n  \u003c!-- \u003clazy-loading-image\u003e Web Component --\u003e\n  \u003cscript src=\"node_modules/lazy-loading-img/dist/lazyloadingimg.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003clazy-loading-img src=\"http://placehold.it/400x300\" alt=\"Lorem ipsum\"\u003e\u003c/lazy-loading-img\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\u003cbr /\u003e\n\n![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D\u0026colorA=16161d\u0026style=flat-square)\n\n## Stencil\n\nStencil is a compiler for building fast web apps using Web Components.\n\nStencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool.  Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.\n\nStencil components are just Web Components, so they work in any major framework or with no framework at all.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlStar01%2Flazy-loading-img","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlStar01%2Flazy-loading-img","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlStar01%2Flazy-loading-img/lists"}