1.0.53 • Published 3 years ago

waterflow.js v1.0.53

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

waterflow.js

A library that implements waterfall flow

It can works with React, Vue, etc

Install

Demo

npm install waterflow.js
yarn add waterflow.js
  • one

  • two

Usage
<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>
es6

import waterfall from 'waterflow.js'

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

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

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

const container = document.querySelector('.container')
waterfall(container, 314, 20)
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
...
### 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

1.0.48

3 years ago

1.0.49

3 years ago

1.0.51

3 years ago

1.0.50

3 years ago

1.0.53

3 years ago

1.0.52

3 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.47

3 years ago

1.0.46

3 years ago

1.0.45

3 years ago

1.0.42

4 years ago

1.0.40

4 years ago

1.0.41

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.28

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.13

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago