I'm trying something out with flex slider where i have my non-active slides at 0.5 opacity, and the main fully visible. The viewport is set to 1280px wide, and the slide should center within the viewport. But on first load of the page, until the slider moves to the next slide and slides thereafter, the li is not centered within the viewport.
I've made a demo of the problem: http://jsfiddle.net/XMXGJ/94/
You will notice on first load you see parts of two slides, until it moves to the next slide then the li centers as it's supposed to.
For the purposes of the demo I've set flexslider to be 350px
wide. What i want to achieve is to get the first slide centered within the viewport on first load.
The HTML:
<div class="flexslider loading">
<ul class="slides">
<li>
<img src="http://placehold.it/350x150" />
</li>
<li>
<img src="http://placehold.it/350x150" />
</li>
<li>
<img src="http://placehold.it/350x150" />
</li>
<li>
<img src="http://placehold.it/350x150" />
</li>
</ul>
</div>
JS:
$('.flexslider').flexslider({
animation: "slide",
animationLoop: true,
startAt: 0,
start: function(slider) {
slider.removeClass('loading');
}
});
CSS:
.flexslider {
margin: 0;
height: 483px;
background: #fff;
position: relative;
zoom: 1;
overflow: hidden;
}
.flex-viewport {
width: 350px;
margin: 0 auto;
overflow: visible;
max-height: 2000px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.loading {
max-height: 483px;
}
.flexslider .slides {
zoom: 1;
}
.flexslider .slides li {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5;
}
.flexslider .slides li.flex-active-slide {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
opacity: 1;
}
.carousel li {
margin-right: 5px;
}