1.1.2 • Published 6 years ago

multipleable-slider v1.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Slider

Start from rollup-starter-project

Demo

multipleable-slider

Usage

npm i --save-dev multipleable-slider
# If you can not install, please try
npm --registry=https://registry.npm.taobao.org install --save-dev multipleable-slider
import slider from 'multipleable-slider'

new slider({
  parentContainer: '.m-slider2',
  sliderChildrens: ['.carouse-news ul'],
  sliderBtnNode: '.carouse-dots',
  isAutoPlay: true,
  distance: 0.2
})

APIs

PropertyTypeDefaultDescription
parentContainerString'.slider-container'Target element to listen touch events on.
sliderChildrensString[]'.slider-wrap'CSS class name of slide, parentContainer can control two slider, For example '.slider-wrap1', '.slider-wrap2'
sliderBtnNodeStringString with CSS selector or HTML element of the container with pagination. If empty disply none
isAutoPlaybooleanfalseWhether to turn on autoplay
delayTimenumber500Delay between transitions (in ms)
intervalnumber5000Auto-play interval
distancefloat0.3Threshold value in (0 ~ 1). If "touch distance" will be lower than (parentContainer.clientWidth * distance) then slider will not move
directionString'left'Auto play direction, currently only supports left
isLoopPlaybooleantrueWhether to loop
参数类型默认值说明
parentContainerString'.slider-container'slider控制器容器,监听slider的touch事件
sliderChildrensString[]'.slider-wrap'轮播图容器,数组类型,一个控制器可以控制多个轮播,比如'.slider-wrap1', '.slider-wrap2'
sliderBtnNodeString轮播导航,没有或为空则不显示
isAutoPlaybooleanfalse是否自动播放,true: 自动播放 false: 不自动播放
delayTimenumber500滑动一屏的过渡时间
intervalnumber5000自动播放的间隔
distancefloat0.3滑动阈值比例,如果滑动距离低于parentContainer的宽度的0.3倍,则不移动
directionString'left'自动播放的方向,目前只支持left
isLoopPlaybooleantrue是否循环播放,true: 循环播放 false: 不循环播放