https://github.com/nechehin/lazyload
Javascript plugin for lazy load images with IntersectionObserver
https://github.com/nechehin/lazyload
image-loading images img intersectionobserver javascript javascript-plugin lazyload
Last synced: 6 days ago
JSON representation
Javascript plugin for lazy load images with IntersectionObserver
- Host: GitHub
- URL: https://github.com/nechehin/lazyload
- Owner: nechehin
- Created: 2017-07-28T22:04:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-12T20:56:20.000Z (about 7 years ago)
- Last Synced: 2025-03-09T09:41:41.094Z (11 months ago)
- Topics: image-loading, images, img, intersectionobserver, javascript, javascript-plugin, lazyload
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lazyload
Javascript plugin for lazyload images and iframes. Fork of https://github.com/tuupola/jquery_lazyload , but with IntersectionObserver mode support
. Support src, srcset attributes for image and src for iframe. Use it as data-src, data-srcset.
## Install
### Load as script in your HTML
Copy source to yout public dir and connect script in HTML page. Example:
```html
![]()
$('.lazy').lazyload();
```
### As NPM module
```sh
npm i @nechehin/lazyload
```
use:
```javascript
import 'jquery';
import '@nechehin/lazyload';
jQuery(function() {
jQuery('.lazy').lazyload();
});
```
## How to use
```html
![]()
```
then in your code do:
```js
$(".lazy").lazyload();
```