Flexslider <li> height's equal the tallest <li> on a mobile browser

怎甘沉沦 提交于 2019-11-29 15:19:53

Hmm, I ran into this issue awhile ago. I hope this helps!

var evenSliderHeight = function(slideContainer, slideItem) {
  var slider_height = 0;
  var $slider_slide = $(slideContainer).find(slideItem);
  $slider_slide.each(function() {
    var __height = $(this).outerHeight(true);
    if ( slider_height < __height ) {
       slider_height = __height;
    }
  });
  $slider_slide.css('min-height', slider_height);
};
evenSliderHeight('.flexslider-container', '.slide');
$('.flexslider').flexslider({
  after: function(slider){
    currHeight = $('.flexslider').find('.slides > li').eq(slider.currentSlide).outerHeight(true);
    $('.flexslider').height(currHeight);
  }
});

JSFiddle Update: http://jsfiddle.net/CsCyh/14/


Kenneth Irvine

Add this to the script that calls the slider.

animateHeight: false,

eg.:

$(window).load(function(){ if ( $('#content-slider-wrap').length == 0 ) return false
    $('#content-slider-wrap').flexslider({
        animation:"fade",
        slideshow: true,
        directionNav: true,
        animateHeight: false,
        controlNav:false ,
........... etc etc
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!