当前位置:网站首页>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();
}边栏推荐
- Redis type
- Rendering process, how the code becomes a page (2)
- Wang Shuang assembly language detailed learning notes 3: registers (memory access)
- 在外包公司两年了,感觉快要废了
- FreeRTOS startup process, coding style and debugging method
- Interview fraud: there are companies that make money from interviews
- 欧拉路/欧拉回路
- Keil Chinese garbled code solution
- jsonp 单点登录 权限检验
- HDU 3585 maximum shortest distance
猜你喜欢

Evolution of ape counseling technology: helping teaching and learning conceive future schools

FreeRTOS learning (I)

Rendering process, how the code becomes a page (I)

Youxuan database participated in the compilation of the Research Report on database development (2022) of the China Academy of communications and communications

字符串0123456789abcdef,子串(非空且非同串本身)的个数是多少【杭州多测师】【杭州多测师_王sir】...

(clone virtual machine steps)

Method of converting UI file to py file

Testcafe provides automatic waiting mechanism and live operation mode

Use and expansion of fault tolerance and fusing

Research on the design of robot education in stem course
随机推荐
HDU 1530 maximum clique
MySQL 默认隔离级别是RR,为什么阿里等大厂会改成RC?
Automated test tool playwright (quick start)
Leetcode 454. Adding four numbers II
What is the core value of testing?
阿里巴巴面试题【杭州多测师】【杭州多测师_王sir】
Use and expansion of fault tolerance and fusing
Know etcd
After easycvr is connected to the national standard equipment, how to solve the problem that the equipment video cannot be played completely?
After a year of unemployment, I learned to do cross-border e-commerce and earned 520000. Only then did I know that going to work really delayed making money!
网络安全基本知识——密码(一)
(manual) [sqli labs27, 27a] error echo, Boolean blind injection, filtered injection
Mysql database -- first knowledge database
[learning record] data enhancement 1
100 lectures on Excel practical application cases (XI) - tips for inserting pictures in Excel
数据安全逐步落地,必须紧盯泄露源头
Redis configuration file explanation / parameter explanation and elimination strategy
机器人教育在STEM课程中的设计研究
[Hongke technology] Application of network Multimeter in data center
Design and development of C language ATM system project