I am trying to figure out an issue with Flexslider that only appears when I test it on an mobile browser such as Safari Mobile.
All of the <li> containers are the same height as the tallest <li>, even when there is not enough content to justify making them equal heights.
I am not sure how to grab a screen shot of this since it works fine on a desktop browser but not on mobile browsers. Here's a fiddle that shows it working as I would expect when I view it on my desktop browser, the container's height resizes depending on the ammount of content.
Here is the hml:
<div class="flexslider">
<ul class="slides">
<li>
<img src="http://i.imgur.com/YSVlz2Z.jpg" />
<h2><a href"#">First Link Here</a></h2>
<p>Some text here that could be a message</p>
<a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right">Another Link Here</a>
</li>
<li>
<img src="http://i.imgur.com/YSVlz2Z.jpg" />
<h2><a href"#">Second Link Here</a></h2>
<p>Some text here that could be a message</p>
</li>
<li>
<img src="http://i.imgur.com/YSVlz2Z.jpg" />
<h2><a href"#">Third Link Here</a></h2>
<p>Some text here that could be a message</p>
</li>
</ul>
</div>
Here's the JS for flexslider:
$('.flexslider').flexslider();
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/
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
来源:https://stackoverflow.com/questions/15752070/flexslider-li-heights-equal-the-tallest-li-on-a-mobile-browser