Flickerplate是一个jquery图片轮播插件。使用时需要使用Modernizr来做触摸检测,所以必须引入jQuery和Modernizr。
引入必要的js文件和css文件
<head> // Required javascript <script src="js/min/jquery-v1.10.2.min.js"></script> <script src="js/min/modernizr-custom-v2.7.1.min.js"></script> <script src="js/min/jquery-finger-v0.1.0.min.js"></script> // Flickerplate <script src="js/min/flickerplate.min.js"></script> <link href="css/flickerplate.css" rel="stylesheet" type="text/css"> </head>
HTML结构
<div class="flicker-example"> <ul> <li data-background="img/flicker-1.jpg"> <div class="flick-title"> Flickerplate Is Working </div> <div class="flick-sub-text"> Heaven forbid this package you downloaded is broken. That wouldn't be embarrassing at all. </div> </li> <li data-background="img/flicker-2.jpg"> <div class="flick-title"> Editable via Javascript or CSS </div> <div class="flick-sub-text"> Take a look at the extensive documentation to see how you can change the settings in multiple ways. </div> </li> <li data-background="img/flicker-3.jpg"> <div class="flick-title"> Touch Enabled Through the Hammer.js Library </div> <div class="flick-sub-text"> Hammer.js is a great touch library that has been included as part of the Flickerplate package. </div> </li> </ul> </div>
js
<script> $(function(){ $('.flicker-example').flickerplate( { auto_flick : true, auto_flick_delay : 8, flick_animation : 'transform-slide' }); }); </script>