jQuery点击左右滚动滑块实现图片滚动插件
2013-09-05 20:25
861 查看
左右滚动不是自动滚动的那种而我们点击左右块就可以实现快速切换效果,下面我来给大家推荐一款不错的jQuery点击左右滚动滑块实现图片滚动插件,有需要了解学习的朋友可参考。简约不简单,点击左右滚动jQuery滑块插件
加载css
加载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;} #container {width: 80%; max-width: 800px; margin: 0 auto;} h2 {padding: 20px 0 30px; font-size: 18px; line-height: 22px; font-style: italic;} h2 a {text-decoration: none; color: #427f9e;} h2 a:hover {border-bottom: 1px dotted #427f9e;} /* Browser Resets */ .flex-container a:active, .flexslider a:active {outline: none;} .slides, .flex-control-nav, .flex-direction-nav {margin: 0; padding: 0; list-style: none;} /* FlexSlider Necessary Styles *********************************/ .flexslider {width: 100%; margin: 0; padding: 0;} .flexslider .slides > li {display: none;} /* Hide the slides before the JS is loaded. Avoids image jumping */ .flexslider .slides img {max-width: 100%; display: block;} .flex-pauseplay span {text-transform: capitalize;} /* Clearfix for the .slides element */ .slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;} html[xmlns] .slides {display: block;} * html .slides {height: 1%;} a{outline:none;blr:expression(this.onFocus=this.blur());} /* No JavaScript Fallback */ /* If you are not using another script, such as Modernizr, make sure you * include js that eliminates this class on page load */ .no-js .slides > li:first-child {display: block;} /* FlexSlider Default Theme *********************************/ .flexslider {background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; zoom: 1;} .flexslider .slides {zoom: 1;} .flexslider .slides > li {position: relative;} /* Suggested container for "Slide" animation setups. Can replace this with your own, if you wish */ .flex-container {zoom: 1; position: relative;} /* Caption style */ /* IE rgba() hack */ .flex-caption {background:none; -ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000,endColorstr=#4C000000); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000,endColorstr=#4C000000); zoom: 1;} .flex-caption {width: 96%; padding: 2%; position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.3); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.3); font-size: 14px; line-height: 18px;} /* Direction Nav */ .flex-direction-nav li a {width: 52px; height: 52px; margin: -13px 0 0; display: block; background: url(../images/bg_direction_nav.png) no-repeat 0 0; position: absolute; top: 50%; cursor: pointer; text-indent: -9999px;} .flex-direction-nav li a.next {background-position: -52px 0; right: -21px;} .flex-direction-nav li a.prev {background-position: 0 0; left: -20px;} .flex-direction-nav li a.disabled {opacity: .3; filter:alpha(opacity=30); cursor: default;} /* Control Nav */ .flex-control-nav {width: 100%; position: absolute; bottom: -30px; text-align: center;} .flex-control-nav li {margin: 0 0 0 5px; display: inline-block; zoom: 1; *display: inline;} .flex-control-nav li:first-child {margin: 0;} .flex-control-nav li a {width: 13px; height: 13px; display: block; background: url(../images/bg_control_nav.png) no-repeat 0 0; cursor: pointer; text-indent: -9999px;} .flex-control-nav li a:hover {background-position: 0 -13px;} .flex-control-nav li a.active {background-position: 0 -26px; cursor: default;}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>
相关文章推荐
- jquery插件实现图片的左右滚动
- jquery插件jquery.LightBox.js实现点击放大图片并左右点击切换效果(附demo源码下载)
- 基于jquery实现点击左右按钮图片横向滚动
- 基于jquery实现点击左右按钮图片横向滚动
- js图片左右滚动的jquery插件(点击滚动和自动滚动)
- jquery图片滚动插件(可自定义数字样式和左右点击按钮)
- jquery插件jquery.beforeafter.js实现左右拖拽分隔条对比图片的方法
- 点击左右按钮图片横向滚动jquery
- jQuery实现的无缝广告图片左右滚动功能详解
- 基于jquery实现左右按钮点击的图片切换效果
- Jquery实现图片左右自动滚动示例
- jquery实现图片的左右滚动
- jQuery 图片左右水平滚动插件
- js实现左右点击图片层叠滚动特效
- 点击上下页,实现图片滚动的jquery代码
- jquery实现图片左右间隔滚动特效(可自动播放)
- 利用jQuery简单实现产品展示图片左右滚动功能(示例代码)
- Jquery实现图片左右自动滚动
- JQUERY JFLOW图片滚动插件左右按钮控制图片内容滑动切换