{"id":19522215,"url":"https://github.com/captaincodeman/lazy-img","last_synced_at":"2025-04-26T09:32:07.351Z","repository":{"id":66357879,"uuid":"80292914","full_name":"CaptainCodeman/lazy-img","owner":"CaptainCodeman","description":"Lazy loading img","archived":false,"fork":false,"pushed_at":"2018-09-19T18:28:14.000Z","size":2853,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T10:36:33.788Z","etag":null,"topics":["image","img","lazy-loading","lazyloading","page-speed","polymer","webcomponents"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaptainCodeman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-28T15:47:20.000Z","updated_at":"2022-07-26T04:31:37.000Z","dependencies_parsed_at":"2023-02-23T04:16:00.263Z","dependency_job_id":null,"html_url":"https://github.com/CaptainCodeman/lazy-img","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Flazy-img","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Flazy-img/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Flazy-img/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Flazy-img/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaptainCodeman","download_url":"https://codeload.github.com/CaptainCodeman/lazy-img/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250967238,"owners_count":21515564,"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":["image","img","lazy-loading","lazyloading","page-speed","polymer","webcomponents"],"created_at":"2024-11-11T00:37:48.015Z","updated_at":"2025-04-26T09:32:07.345Z","avatar_url":"https://github.com/CaptainCodeman.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Published on Vaadin  Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/CaptainCodemanlazy-img)\n[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/CaptainCodemanlazy-img.svg)](https://vaadin.com/directory/component/CaptainCodemanlazy-img)\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/CaptainCodeman/lazy-img)\n\n_[Demo and API docs](http://captaincodeman.github.io/lazy-img/)_\n\n# \\\u003clazy-image\\\u003e\n\n`lazy-img` is a lazy loading img element that is shadow-dom friendly\nand uses [IntersectionObserver](https://developers.google.com/web/updates/2016/04/intersectionobserver)\nto detect when images are within the viewport and need to be loaded.\n\nThe default behavior is to use the browser viewport but more specific control\ncan be provided by setting the `observe` property to a parent selector (either\nan element id, class or tag name):\n\n```\n\u003cdiv id=\"myscroller\"\u003e\n        \u003clazy-img src=\"image1.jpg\" observe=\"#myscroller\"\u003e\u003c/lazy-img\u003e\n        \u003clazy-img src=\"image2.jpg\" observe=\"#myscroller\"\u003e\u003c/lazy-img\u003e\n        ...\n        \u003clazy-img src=\"image99.jpg\" observe=\"#myscroller\"\u003e\u003c/lazy-img\u003e\n\u003cdiv\u003e\n```\n\n`margin` and `threshold`  allow control over exactly when the loading is triggered as the\nelement comes into view. `margin` can reduce or extend the detection area of the container\nand `threshold` can determine what proportion of the image needs to be within the area.\n\nDemo is based on [this example of intersection-observer](https://github.com/wilsonpage/in-sixty/blob/gh-pages/intersection-observer/index.html)\n\nIf used on a browser without support for `IntersectionObserver` a polyfill will be\nloaded automatically from the [polyfill.io service](https://polyfill.io/v2/docs/).\n\nConfigure this with the following code in `index.html`:\n\n```\n\u003cscript\u003e\n  // Define polyfills for features that our app depends on:\n  window.PolyPoly = {\n    features: []\n  };\n  ('IntersectionObserver' in window) || window.PolyPoly.features.push('IntersectionObserver');\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincodeman%2Flazy-img","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptaincodeman%2Flazy-img","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincodeman%2Flazy-img/lists"}