当前位置:网站首页>Tips for using swiper (1)
Tips for using swiper (1)
2022-07-28 05:00:00 【JINZI village grass】
Swiper It's a very easy-to-use plug-in , Meet various use conditions and environments , Response type , Multiple columns , Multiple lines , wait , however , Many times, there are still some conditions Swiper Provided API It can't directly help us solve the problem , But it can be handled in a flexible way . What I want to share today is about swiper Left and right switch buttons , Display or hide problems of paging navigation .
Sometimes , Our needs are like this ,1, When swiper When there are no more pages , The left and right buttons do not appear ,2, More than one page , Left and right buttons appear , But not forward or backward , There will be left and right buttons that cannot be clicked state .
swiper During initialization, the left and right buttons that cannot be clicked will be added ‘swiper-button-disabled’ This class, We can use css For this class Add the appropriate style , If you want to hide , You can hide it directly , But to do so , When only one of the left and right buttons is disabled In the state of , There will be situations where one side has no side . The solution to this problem is , We are swiper Get after initialization swiper object , And get swiper.isBeginning and swiper.isEnd attribute , Then judge if these two attributes are true That means ,swiper At the same time , Neither forward slide You can't go backwards slide 了 , That means there is no more than one page , Then we can execute the logic we want to execute .
Of course , If your swiper It is not responsive to adjust the number of displays according to the screen size , Then don't bother , Direct judgment slide That's enough ,
It should be noted that , When judging in this way , Must be in browser When the window size changes , Manual trigger swiper Of update event , And then get isBeginning and isEnd attribute , Only in this way can we get swiper The result after adjusting the quantity responsively .
gridSwiper.update();
let $gridSwiperCheck = this.$('.swiper-container-horizontal .home-todo-check');
if (gridSwiper.isBeginning === gridSwiper.isEnd) {
$gridSwiperCheck.hide();
} else {
$gridSwiperCheck.show();
}边栏推荐
- 面试了一位38岁程序员,听说要加班就拒绝了
- Mysql database -- first knowledge database
- Gan: generative advantageous nets -- paper analysis and the mathematical concepts behind it
- Win10 machine learning environment construction pycharm, anaconda, pytorch
- Testcafe provides automatic waiting mechanism and live operation mode
- 王爽汇编语言详细学习笔记三:寄存器(内存访问)
- MySQL(5)
- Rendering process, how the code becomes a page (2)
- Leetcode 454. Adding four numbers II
- (2.4) [service Trojan -slimftp] introduction and use
猜你喜欢
![[function document] torch Histc and paddle Histogram and numpy.histogram](/img/ee/ea918f79dc659369fde5394b333226.png)
[function document] torch Histc and paddle Histogram and numpy.histogram

(clone virtual machine steps)

RT_ Use of thread message queue

吉利AI面试题【杭州多测师】【杭州多测师_王sir】

Use animatedbuilder to separate components and animation, and realize dynamic reuse

Special topic of APP performance design and Optimization - poor implementation affecting performance

What is the reason why the easycvr national standard protocol access equipment is online but the channel is not online?

Real intelligence has been certified by two of the world's top market research institutions and has entered the global camp of excellence

Read the paper -- a CNN RNN framework for clip yield prediction

FreeRTOS startup process, coding style and debugging method
随机推荐
[每日一氵]上古年代的 Visual Studio2015 安装
(克隆虚拟机步骤)
Activation functions sigmoid, tanh, relu in convolutional neural networks
Program life | how to switch to software testing? (software testing learning roadmap attached)
The default isolation level of MySQL is RR. Why does Alibaba and other large manufacturers change to RC?
CPU and memory usage are too high. How to modify RTSP round robin detection parameters to reduce server consumption?
Chuangyuan will join hands with 50+ cloud native enterprises to explore new models to cross the digital divide
Performance comparison between set and list
POJ 3728 the merchant (online query + double LCA)
Clickhouse填坑记2:Join条件不支持大于、小于等非等式判断
使用nfpm制作rpm包
With a monthly salary of 15.5K, he failed to start a business and was heavily in debt. How did he reverse the trend through software testing?
Handling of web page image loading errors
What is the reason why the easycvr national standard protocol access equipment is online but the channel is not online?
Depth traversal and breadth traversal of tree structure in JS
App test process and test points
Research on the design of robot education in stem course
Service object creation and use
Web渗透之域名(子域名)收集方法
Is low code the future of development? On low code platform