Materialize轮播组件的使用,html代码如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <div class="slider"> <ul class="slides"> <li> <img src="http://lorempixel.com/580/250/nature/1"> <!-- random image --> <div class="caption center-align"> <h3>这是一个巨大的标签行</h3> <h5 class="light grey-text text-lighten-3">这是我们的小口号。</h5> </div> </li> <li> <img src="http://lorempixel.com/580/250/nature/2"> <!-- random image --> <div class="caption left-align"> <h3>左对齐标题</h3> <h5 class="light grey-text text-lighten-3">这是我们的小口号。</h5> </div> </li> <li> <img src="http://lorempixel.com/580/250/nature/3"> <!-- random image --> <div class="caption right-align"> <h3>右对齐标题</h3> <h5 class="light grey-text text-lighten-3">这是我们的小口号。</h5> </div> </li> <li> <img src="http://lorempixel.com/580/250/nature/4"> <!-- random image --> <div class="caption center-align"> <h3>这是一个巨大的标签行</h3> <h5 class="light grey-text text-lighten-3">这是我们的小口号。</h5> </div> </li> </ul> </div>
|
js代码如下:
1 2 3 4 5 6 7 8 9
| $(document).ready(function() { $('.slider').slider({ full_width: true, interval: 2000, transition: 1000, height: 500, indicators: true }); });
|
效果图:
源码:code.zip