swiper - 如何在 SwiperJS 容器外使用分页?
问题描述
如何在 swiper-container 类之外使用分页?我使用 Swiper.js 和分页功能。 红色区域:可拖动区域,但我需要这个区域不可拖动。
如何将分页从可拖动区域移动到不可拖动区域?
我的代码:
HTML/PHP
<div class="swiper-container">
<div class="swiper-wrapper">
<?php while ($posts_args->have_posts()) : $posts_args->the_post(); ?>
<div class="swiper-slide">
<?php get_template_part('template-parts/cards/card', 'article'); ?>
</div>
<?php endwhile; ?>
</div>
<div class="swiper-pagination"></div>
</div>
Javascript:
var Slider = (function() {
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
spaceBetween: 10,
grabCursor: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
breakpoints: {
0: {
slidesPerView: 1,
spaceBetween: 10,
},
992: {
slidesPerView: 2,
spaceBetween: 15,
},
1200: {
slidesPerView: 3,
spaceBetween: 20,
}
}
});
})();
解决方案
推荐阅读
- google-signin - Google OAuth 2.0 - 离线访问的增量授权
- javascript - google-maps-react 在拖动结束时获取标记位置
- python - Python Argparse 子解析器
- ruby-on-rails - 有没有办法知道迁移正在运行?
- python - numpy 随机生成器有偏差吗?
- python - 如何在python icrawler中使用搜索关键字重命名爬虫文件
- c# - WCF crm 连接失败,由于字符串不安全
- razor - 如何在 ASP.NET 网页中进行 MD5 散列(razor 语法/cshtml)
- python - 如何移动图片按钮?Pyqt5 蟒蛇
- git - Git,错误:远程解包失败:无法创建临时对象目录-通过创建新分支