0.0.5 • Published 3 years ago

ng2-swiper5 v0.0.5

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

Ng2Swiper

Ng2Swiper是基于swiper5.3.0版本封装的一个用于angular2+的组件。 演示地址

安装说明

使用方法

api

目前只封装了swiper5的部分参数设置,后续会逐步添加。

basic 一般选项

名称默认值说明
initialSlide0设定初始化时slide的索引
direction'horizontal' , 'vertical'滑动方向
speed300切换速度
grabCursorfalse鼠标覆盖Swiper时指针会变成手掌形状
parallaxfalse开启视差效果
parallaxImgUrlstring视差背景图
parallaxPer'-23%'移动距离
parallaxOpacity0.5视差透明度变化
parallaxScale0.5视差缩放变化
parallaxDuration3000设定视差动画持续时间(ms)
autoHeightfalse高度随内容变化
uniqueNavElementsfalse控制组件放在container外面的时候,需要用到
runCallbacksOnInitfalse触发回调,如果不想触发,将此设置为false
slidesPerColumnFill'column' , 'row'多行布局

Slides grid(网格分布)

名称默认值说明
centeredSlidesfalseactive slide会居中
centeredSlidesBoundsfalse使得第一个和最后一个Slide 始终贴合边缘
navigationfalse左右箭头切换开关
slidesPerView1slider容器能够同时显示的slides数量
slidesPerGroup1定义slides的数量多少为一组
slidesPerGroupSkip0设置跳过分组
spaceBetween0在slide之间设置距离(单位px)
slidesPerColumn1设置多行布局里面每列的slide数量

Free Mode (free模式/抵抗反弹)

名称默认值说明
freeModefalseslide会根据惯性滑动可能不止一格且不会贴合
freeModeMomentumtruefree模式动量
freeModeMomentumRatio1设置的值越大,当释放slide时的滑动时间越长
freeModeMomentumVelocityRatio1free模式惯性速度,设置越大,释放后滑得越快

其他参数

名称默认值说明
swiperCont'swiper-container'设置swiper的id
paginationShowtrue是否显示分页器
isObservertrue修改swiper自己或子元素时,自动初始化swiper
autoplayfalse自动播放
delay3自动播放间隔时间(秒)
0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago