{"id":13805185,"url":"https://github.com/andreruffert/progressive-image-element","last_synced_at":"2025-05-16T02:09:50.709Z","repository":{"id":37982021,"uuid":"237288524","full_name":"andreruffert/progressive-image-element","owner":"andreruffert","description":"⚡️ Progressively enhance image placeholders once they are in the viewport","archived":false,"fork":false,"pushed_at":"2025-05-09T09:08:37.000Z","size":2886,"stargazers_count":267,"open_issues_count":0,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-16T02:09:47.434Z","etag":null,"topics":["custom-element","lazy-loading","placeholder-image","progressive-image","web-component"],"latest_commit_sha":null,"homepage":"https://andreruffert.github.io/progressive-image-element/","language":"HTML","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/andreruffert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null},"funding":{"github":["andreruffert"],"custom":["https://paypal.me/andreruffert","https://thx.to/:andre"]}},"created_at":"2020-01-30T19:25:55.000Z","updated_at":"2025-05-15T03:51:12.000Z","dependencies_parsed_at":"2025-04-09T04:00:29.622Z","dependency_job_id":"ca7a6fe6-eda1-47b7-9429-08a49103cb4a","html_url":"https://github.com/andreruffert/progressive-image-element","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fprogressive-image-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fprogressive-image-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fprogressive-image-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fprogressive-image-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreruffert","download_url":"https://codeload.github.com/andreruffert/progressive-image-element/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453667,"owners_count":22073618,"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":["custom-element","lazy-loading","placeholder-image","progressive-image","web-component"],"created_at":"2024-08-04T01:00:58.390Z","updated_at":"2025-05-16T02:09:50.656Z","avatar_url":"https://github.com/andreruffert.png","language":"HTML","funding_links":["https://github.com/sponsors/andreruffert","https://paypal.me/andreruffert","https://thx.to/:andre"],"categories":["Real World"],"sub_categories":["Components"],"readme":"# \u0026lt;progressive-image\u0026gt; element\n\n\u003e Progressively enhance image placeholders once they are in the viewport.\n\n[![Test](https://img.shields.io/github/actions/workflow/status/andreruffert/syntax-highlight-element/test.yml?label=Test\u0026logo=github\u0026color=ffc300\u0026labelColor=212121)](https://github.com/andreruffert/progressive-image-element/actions/workflows/test.yml)\n[![npm version](https://img.shields.io/npm/v/progressive-image-element.svg?color=ffc300\u0026labelColor=212121)](https://www.npmjs.com/package/progressive-image-element)\n[![npm downloads](https://img.shields.io/npm/dm/progressive-image-element?logo=npm\u0026color=ffc300\u0026labelColor=212121)](https://www.npmjs.com/package/progressive-image-element)\n\n* **Faster page load**: Images are loaded only as they enter the viewport, using native browser lazy loading with placeholders\n* **Visual stability**: Prevent layout shifts when loading images\n* **Save data option**: Load images only on demand\n* **No dependencies**: Framework agnostic web component\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"example-2x.png\" alt=\"progressive image element markup example\" width=\"774\"\u003e\n\u003c/div\u003e\n\n\n## Install\n\n```console\n$ npm install progressive-image-element\n```\n\n\n## Usage\n\n1. Include the script \u0026 stylesheet within your application\n\n  ```html\n  \u003c!-- Include the stylesheet, this could be direct from the package or CDN --\u003e\n  \u003clink rel=\"stylesheet\" href=\"https://unpkg.com/progressive-image-element@latest/dist/progressive-image-element.css\" /\u003e\n\n  \u003c!-- Include the custom element script, this could be direct from the package or CDN --\u003e\n  \u003cscript type=\"module\" src=\"https://unpkg.com/progressive-image-element@latest/dist/progressive-image-element.js\"\u003e\u003c/script\u003e\n  ```\n\n  or\n\n  ```js\n  // Import the custom element script\n  import ProgressiveImageElement from 'progressive-image-element';\n  ```\n\n2. Use the `\u003cprogressive-image\u003e` element markup\n\n  ```html\n  \u003cprogressive-image\n    src=\"example-image-1x.jpg\"\n    srcset=\"example-image-2x.jpg 2x, example-image-1x.jpg 1x\"\n  \u003e\n    \u003c!-- Make sure to specify image dimensions --\u003e\n    \u003cimg src=\"placeholder-image.jpg\" width=\"300\" height=\"200\" alt=\"Image\" /\u003e\n  \u003c/progressive-image\u003e\n  ```\n  The placeholder image should be a solid color placeholder, [LQIP](http://www.guypo.com/introducing-lqip-low-quality-image-placeholders) or [SQIP](https://github.com/technopagan/sqip) that hint at the content of the progressive image before it loads.\n\n\n## Attributes\n\n- `src` Specifies the image to display\n- `srcset` One or more [image candidate strings](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset)\n- `sizes` Comma-separated list of [source size descriptors](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes)\n- `savedata` Boolean attribute to load the images only after a click/tap on the placeholder image.   \n  By default enabled for slow connections (`slow-2g|2g|3g`).\n\n\n## Styling states\n\nA CSS class `loadable` is present on `\u003cprogressive-image\u003e` when the image is ready to load on user interaction (`click`).\nUsed for slow connections or when the `savedata` attribute is present.\n```css\nprogressive-image.loadable { ... }\n```\n\nA CSS class `[loading]` is present on `\u003cprogressive-image\u003e` while the image is loading.\n```css\nprogressive-image.loading { ... }\n```\n\nA CSS class `.loaded` is present on `\u003cimg\u003e` children of `\u003cprogressive-image\u003e` when the image was loaded.\n```css\nprogressive-image \u003e img { opacity: 0; }\nprogressive-image \u003e img.loaded { opacity: 1; }\n```\n\n\n## License\n\nDistributed under the MIT license. See LICENSE for details. \n\n© [André Ruffert](https://andreruffert.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreruffert%2Fprogressive-image-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreruffert%2Fprogressive-image-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreruffert%2Fprogressive-image-element/lists"}