swiper轮播箭头垂直居中

取消懒加载


for (var i in $('.p01-s9 .lazyload')) {
$('.p01-s9 .lazyload').eq(i).attr('src',$('.p01-s9 .lazyload').eq(i).attr('data-src'));
}
$('.p01-s9 .lazyload').removeClass('lazyload').addClass('lazyloaded');


//轮播箭头垂直居中
function reactiveGallaryArrowTop($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(){

      reactiveGallaryArrowTop('#p01-s5');                    

                }
            }

 
        $(window).resize(function () {
            reactiveGallaryArrowTop('.p11-1-s4');
        });

posted on 2019-10-15 18:04  巧丽  阅读(508)  评论(0编辑  收藏  举报

导航