jQM - Flexslider example
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="http://flexslider.woothemes.com/css/flexslider.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="http://flexslider.woothemes.com/js/jquery.flexslider.js"></script>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
<a href="#second" class="ui-btn-right">Next</a>
</div>
<div data-role="content">
<div class="flexslider">
<ul class="slides">
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_cheesecake_brownie.jpg" />
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_lemon.jpg" />
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_donut.jpg" />
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_caramel.jpg" />
</li>
</ul>
</div>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
<ul class="slides">
<li> <img src="http://flexslider.woothemes.com/images/kitchen_adventurer_caramel.jpg" /></li>
</ul>
CSS
.flexslider {height:300px;}
.slides li{
height:300px;
}
.flexslider .slides img{
width:auto!important;
max-width:100%;
position:relative;
transform:translateX(-50%);
}
JavaScript
$(document).on('pageshow', '#index', function(){
setInterval(function(){
$(".slides li img").each(function(){
$(this).height(Math.random()*100+"%").css({top:Math.random()*100+"%", left:Math.random()*100+"%"});
});
},21000);
$(".slides li:not('.flex-active-slide') img").each(function(){
$(this).height(Math.random()*100+"%").css({top:Math.random()*100+"%", left:Math.random()*100+"%"});
});
$('.flexslider').flexslider({
animation: "slide",
animationLoop: true,
slideshowSpeed: 7000,
});
});