继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

解决 Swiper 插件autoHeight问题 建议

android零基础入门
关注TA
已关注
手记 288
粉丝 97
获赞 603

 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())

}


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP