https://github.com/jgw96/st-img
Web Component built with Stencil to lazy load images
https://github.com/jgw96/st-img
Last synced: 5 days ago
JSON representation
Web Component built with Stencil to lazy load images
- Host: GitHub
- URL: https://github.com/jgw96/st-img
- Owner: jgw96
- License: mit
- Created: 2017-09-01T02:57:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T20:10:11.000Z (about 6 years ago)
- Last Synced: 2025-03-29T00:33:24.548Z (22 days ago)
- Language: TypeScript
- Size: 269 KB
- Stars: 59
- Watchers: 3
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-stenciljs - ST Image
README
# st-img

## What is it?
st-img is a web component built with [Stencil](https://stenciljs.com/) that allows you to lazy load images as the user scrolls them into the viewport. On supported browsers (Chrome and chrome based browsers, Firefox and Edge) it uses [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to accomplish this functionality. For Safari and IE it simply falls back to setTimeout.## Usage
To use this component in your app, no matter what framework you are using, follow these steps:- pop this script tag `` into your index.html
## API
Properties:- src (string): the path or url to the image you want to load
- alt (string): the value you want to use for the alt property of the image https://www.w3schools.com/tags/att_img_alt.asp## Examples
```
```