swiper轮播箭头垂直居中

佐手、 提交于 2019-12-01 10:09:54

取消懒加载

if ($('#gallery').length != 0) {
$('#gallery img').removeClass('lazyload').attr('src',$('#gallery img').attr('data-src'));
}
if ($('#s7thumbs').length != 0) {
$('#s7thumbs img').removeClass('lazyload').attr('src',$('#s7thumbs img').attr('data-src'));
}


//轮播箭头垂直居中
function reactive_gallary_arrow_top($swiper) {
var outerHeight = $($swiper).find(".swiper-wrapper").height();
var imgHeight = $($swiper).find(".swiper-slide").find("img").height();
var percentage = 0.5*imgHeight/outerHeight * 100;

var prevArrow = $($swiper).find(".prev");
var nextArrow = $($swiper).find(".next");

prevArrow.css({
"top": percentage + '%'
});
nextArrow.css({
"top": percentage + '%'
});
}
//swiper调用
            on: {
                imagesReady:function () {
                    reactive_gallary_arrow_top('#p01-s5');
                },
                resize:function () {
                    reactive_gallary_arrow_top('#p01-s5');
                }
            }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!