页面加载后,滑动高度最初是正确的。将窗口大小调整为更小时,会重新计算正确的滑动高度。但是当将窗口大小调整为更大时,大部分时间都无法正确计算滑动高度,并且图像被部分隐藏。大多数时候,我的意思是在特定的窗口大小下,高度是正确的。
在移动 Chrome 和 Safari 上,更改方向时,图像会部分隐藏。只有在上下滑动内容后,滑动高度才会正确,图像完全可见。
swiper-container 和图像宽度为 100% 以便响应。
感谢帮助。
- - 代码 - - -
<link rel="stylesheet" href="idangerous.swiper.css">
<style>
.swiper-container {
width: 100%;
text-align: center;
}
.pagination {
position: absolute;
left: 0;
text-align: center;
bottom:5px;
width: 100%;
}
.swiper-pagination-switch {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 10px;
background: #999;
box-shadow: 0px 1px 2px #555 inset;
margin: 0 3px;
cursor: pointer;
}
.swiper-active-switch {
background: #fff;
}
</style>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"> <img src="images/slide1.png" width="100%" /> </div>
<div class="swiper-slide"> <img src="images/slide2.png" width="100%" /> </div>
<div class="swiper-slide">
<div class="content-slide">
<p class="title">Slide with HTML</p>
<p>You can put any HTML inside of slide with any layout, not only images, even another Swiper!</p>
</div>
</div>
</div>
<div class="pagination"></div>
</div>
<script src="idangerous.swiper.min.js"></script>
<script>
$(function() {
var mySwiper = new Swiper('.swiper-container',{
pagination: '.pagination',
loop:true,
grabCursor: true,
paginationClickable: true,
autoplay:3000,
roundLengths: true,
calculateHeight:true
});
});
</script>
<div>Some content goes here. .... </div>