# lazyimgoffscreen

> - 优先加载视区的，延迟加载屏幕以上的(默认3秒延迟)

Latest version **1.0.1** (published 2017-06-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install lazyimgoffscreen
pnpm add lazyimgoffscreen
yarn add lazyimgoffscreen
bun add lazyimgoffscreen
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-06-12 |
| First published | 2017-06-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | erluzi |
| Maintainers | erluzi |

## Links

- npm: https://www.npmjs.com/package/lazyimgoffscreen
- Repository: https://github.com/erluzi/lazyimgoffscreen
- Homepage: https://github.com/erluzi/lazyimgoffscreen#readme
- Issues: https://github.com/erluzi/lazyimgoffscreen/issues
- npm.io page: https://npm.io/package/lazyimgoffscreen

## Recent versions

- 1.0.1 (latest) — 2017-06-12
- 1.0.0 — 2017-06-12

## README

## 图片懒加载
- 优先加载视区的，延迟加载屏幕以上的(默认3秒延迟)
## 实践
- 图片准备:
```
- assets
    - loading.png (作为懒加载图片背景)
    - tm.png (作为懒加载图片src)
```
- dom:
```
<img class="lazy" src="../assets/tm.png" :data-src="goods.iconUrl" alt="商品图片">

```
- 样式:
```
img.lazy{
    display: block;
    background: data-uri('../assets/loading.png') center no-repeat;
    background-size: cover;
}

@keyframes imgOpacity {
    0%{opacity: 0}
    100%{opacity: 1}
}
.img-opacity{
    animation: imgOpacity 300ms linear 0ms 1 normal both;
}

```

- js
```
import lazy from 'lazyimgoffscreen'
lazy.use('.lazy');
```

---
_Source: https://npm.io/package/lazyimgoffscreen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
