# waterflow.js

> [Demo](http://alex-xueyao.gitee.io/v3pro/#/laolai)

Latest version **1.0.53** (published 2022-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install waterflow.js
pnpm add waterflow.js
yarn add waterflow.js
bun add waterflow.js
```

## 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.53 |
| Published | 2022-03-21 |
| First published | 2021-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | dead fish |
| Maintainers | zhousuyang |
| Keywords | water, WaterFall, waterflow, flow, React WaterFall, Vue WaterFall |

## Links

- npm: https://www.npmjs.com/package/waterflow.js
- npm.io page: https://npm.io/package/waterflow.js

## Dependencies (1)

- [core-js](https://npm.io/package/core-js.md) ^3.16.1

## Recent versions

- 1.0.53 (latest) — 2022-03-21
- 1.0.52 — 2022-03-21
- 1.0.51 — 2022-03-21
- 1.0.50 — 2022-03-21
- 1.0.49 — 2022-03-21
- 1.0.48 — 2022-03-21
- 1.0.47 — 2022-01-20
- 1.0.46 — 2022-01-19
- 1.0.45 — 2022-01-18
- 1.0.44 — 2021-12-31
- 1.0.43 — 2021-12-31
- 1.0.42 — 2021-11-16
- 1.0.41 — 2021-11-03
- 1.0.40 — 2021-11-03
- 1.0.39 — 2021-10-15
- … 31 more at https://npm.io/package/waterflow.js/versions

## README

> ## waterflow.js
> ### A library that implements waterfall flow
> ### It can works with React, Vue, etc

###### Install

[Demo](http://alex-xueyao.gitee.io/v3pro/#/laolai)

```bash
npm install waterflow.js
yarn add waterflow.js
```

* one
<img src="https://alex-xueyao.gitee.io/static/one.jpg"/>

* two
<img src="https://alex-xueyao.gitee.io/static/two.jpg" />

###### Usage

```html

<style>
  .container {
    width: 982px;
  }

  .item {
    width: 314px;
  }
</style>

<div class="container">
  <div class="item">
    <img src="./1.png"/>
    One
  </div>
  <div class="item">
    <img src="./2.png"/>
    Two
  </div>
  <div class="item">
    <img src="./3.png"/>
    Three ...
  </div>
</div>
```

```javascript
es6

import waterfall from 'waterflow.js'

const container = document.querySelector('.container')
waterfall(container, 314, 20)
```

```javascript
script

< script
src = "node_modules/waterflow.js/lib/umd.js" > < /script>
const container = document.querySelector('.container')
waterfall(container, 314, 20)
```

```javascript
commonjs

const waterfall = require('waterflow.js/lib/cjs')

const container = document.querySelector('.container')
waterfall(container, 314, 20)
```

```javascript
import waterfall from 'waterflow.js'

render()
{
	return (
		<div ref={ el => {
			this.container = el
		} }>
			<div>
				<img src="..."/>
				<span>...</span>
			</div>
			<div>
				<img src="..."/>
				<span>...</span>
			</div>
			<div>
				<img src="..."/>
				<span>...</span>
			</div>
			<div>
				<img src="..."/>
				<div>...
					<span>...</span>
				</div>
			</div>
		</div>
	)
}
componentDidMount()
{
	waterfall(this.container, 314, 25)
}
componentDidUpdate()
{
	waterfall(this.container, 314, 25) // if necessary
}

if you use
hook, you
can
use
waterfall in useEffect
...
```

```markdown
### waterfall(container, width, gap, bool, time_gap)

### container: Dom

### width: child Width (number),

notice: (width) This value can be passed either by using the width defined in
CSS or by dynamically fetching data from javascript

### gap: gap between childrens (number)

### bool: which ways between one and two

### time_gap: (number) if you use image, time_gap is the time between image load
```

> The waterflow.js library exposes a function that takes three arguments:
>
> ### first argument: container (When using React or Vue, pass in a ref or a DOM depending on the class name, etc.)
>
> ### second: width The width of a single element in the container (type number)
>
> ### third: gap The space between containers

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