简约不简单,点击左右滚动jQuery滑块插件
加载css
代码如下 | 复制代码 |
/* Reset Styles ***********************/ html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed,figure, figcaption, footer, header, hgroup,menu, nav, output, ruby, section, summary,time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;} body {line-height: 1;} ol, ul {list-style: none;} blockquote, q {quotes: none;} blockquote:before, blockquote:after,q:before, q:after {content: ''; content: none;} table {border-collapse: collapse; border-spacing: 0;} strong {font-weight: bold;} em {font-style: italic;} body {background: url(../images/body.png) repeat left top; font-family: 'Georgia', 'Arial', sans-serif;} h2 {padding: 20px 0 30px; font-size: 18px; line-height: 22px; font-style: italic;} /* FlexSlider Necessary Styles /* Clearfix for the .slides element */ /* FlexSlider Default Theme /* Caption style */ /* Direction Nav */ /* Control Nav */ |
html结构
代码如下 | 复制代码 |
<div id="container"> <h2>点击左右滚动jQuery滑块插件</h2> <div class="flexslider"> <ul class="slides"> <li> <img src="images/1.jpg" /> <p class="flex-caption">vps服务器 </p> </li> <li> <a href="" target="_blank"><img src="images/2.jpg" /></a> <p class="flex-caption">骄傲的使用阿里云</p> </li> <li> <a href="" target="_blank"><img src="images/3.jpg" /></a> <p class="flex-caption">万网域名注册</p> </li> <li> <a href="" target="_blank"><img src="images/4.jpg" /></a> <p class="flex-caption">西部数码服务器</p> </li> </ul> </div> </div> |
引入jquery库和jquery插件
代码如下 | 复制代码 |
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> <script src="js/jquery.flexslider-min.js"></script> <script type="text/javascript"> $(window).load(function() { $('.flexslider').flexslider(); }); </script> |