📜  F7滑动滑块

📅  最后修改于: 2021-01-02 06:20:15             🧑  作者: Mango

Framework7滑动滑块

Framework7提供了滑动滑块,这是一个非常强大且现代的触摸滑块。它还提供了很多功能。

滑动滑块的HTML布局


Slide 1
Slide 2
Slide 3
... other slides ...

这里:

swiper-container:它是带有滑块和分页符的主要滑块容器类。必填元素

swiper-wrapper:这是幻灯片的附加包装。必填元素

滑动滑块:它是单个滑块元素。可以在其中包含任何HTML

swiper-pagination:它是带有分页项目符号的容器,将在其中自动创建分页项目符号。它是一个可选元素。

使用JavaScript初始化Swiper

可以使用以下与JavaScript相关的方法来初始化Swiper:

myApp.swiper(swiperContainer,parameters)
OR
new Swiper(swiperContainer, parameters)

参数说明:

swiperContainer:它是HTMLElement或swiper容器的字符串,是必需的。

参数:这些是包含带有滑动参数的对象的可选元素。

注意:以上两种方法均可用于使用选项初始化滑块。

例如:

var mySwiper = app.swiper('.swiper-container', {
    speed: 400,
    spaceBetween: 100
});  

用HTML初始化Swiper

滑行滑块的类型

Framework7中有几种不同类型的刷卡器:

Index Swiper type Description
1) Default Swiper With Pagination It is a modern touch slider and the swiper swipes horizontally. This is a by default swiper.
2) Vertical Swiper This one also works as a default swiper but it swipes vertically.
3) With Space Between Slides This swiper is used to give space between two slides.
4) Multiple Swipers This swiper uses more than one swipers on a single page.
5) Nested Swipers It is the combination of vertical and horizontal slides.
6) Custom Controls It is used for custom controls to choose or swipe any slide.
7) Lazy Loading It can be used for multimedia file, which takes time to load.