Split
安装 (Install)
npm i @qmhc/split --save
使用 (Use)
html
<div id="#app">
<div class="left"></div>
<div class="right"></div>
</div>
js
import Split from '@qmhc/split'
import '@qmhc/split/dist/split.css'
let split = new Split(['#left', '#right'], {
container: '#app',
mode: 'vertical',
min: 300,
value: 0.6,
transition: true,
timely: true
})
let split = new Split(['#left', '#right'], {
container: '#app'
})
split.value = 0.65
split.min = 250
split.transition = true
split.timely = true
const moveStartListener = () => console.log('Move start!')
const movingListener = () => console.log('Moving!')
const moveEndListener = () => console.log('Move end!')
split.on('movestart', moveStartListener)
split.on('moving', movingListener)
split.on('moveend', moveEndListener)
split.on('fullreset', resetListener)
split.on('leftfull', fullListener)
split.on('righttfull', fullListener)
split.on('toptfull', fullListener)
split.on('bottomfull', fullListener)
split.off('movestart', moveStartListener)
split.off('moving', movingListener)
split.off('moveend', moveEndListener)
split.clear('movestart')
split.clear('moving')
split.clear('moveend')
let split2 = new Split([split, '#bottom'])
示例 (Example)
在线示例
授权 (License)
MIT License.