解決 Swiper 插件autoHeight問題 建議
阿新 • • 發佈:2017-09-15
swiper autoheight alert($("body").height())
var mySwiper=$(".swiper-container").swiper({
autoHeight: true,
onSlideChangeStart: function() {
var H = $(".swiper-slide").eq(mySwiper.activeIndex).find(".bigbox").height();
var scH=$(".swiper-container").height();
var bodyH=$("body").height()
if(H<scH){
console.log(scH)
$(".swiper-slide").css(‘height‘, bodyH-20 + ‘px‘);
$(".swiper-wrapper").css(‘height‘, bodyH-20 + ‘px‘);
}else{
$(".swiper-slide").css(‘height‘, H + ‘px‘);
$(".swiper-wrapper").css(‘height‘, H + ‘px‘);
}
console.log("slideH:" + $(".swiper-slide").height())
console.log("wrapperH:" + $(".swiper-wrapper").height())
}
本文出自 “11112450” 博客,轉載請與作者聯系!
解決 Swiper 插件autoHeight問題 建議