首页 > 其他 > 详细

解决 Swiper 插件autoHeight问题 建议

时间:2017-09-15 18:20:57      阅读:423      评论:0      收藏:0      [点我收藏+]

 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)

alert($("body").height())

$(".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问题 建议

原文:http://11122450.blog.51cto.com/11112450/1965651

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!