CoolCarousels集合了多种模式的幻灯片,每种模式都有不同德样式和外观,基于jQuery库构建而成。有带有缩略图导航的幻灯片,有包含动态项的旋转木马等等,你基本上可以在这里找到所有类型的幻灯片。到目前为止,CoolCarousels一共有65种类型,那么接下来我就挑选其中的一些来讲解。
1、引入以下的js和css文件
1 2 | <script src="jquery.carouFredSel-6.2.0-packed.js" type="text/javascript"></script> |
2、在head标签中加入以下js代码
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <script type="text/javascript">$(function() { var $l = $('#carousel-left'), $c = $('#carousel-center'), $r = $('#carousel-right'); $l.carouFredSel({ auto: false, items: 1, direction: 'right', prev: { button: '#prev', fx: 'uncover', onBefore: function() { setTimeout(function() { $c.trigger( 'prev' ); }, 100); } }, next: { fx: 'cover' } }); $c.carouFredSel({ auto: false, items: 1, prev: { onBefore: function() { setTimeout(function() { $r.trigger( 'prev' ); }, 100); } }, next: { onBefore: function() { setTimeout(function() { $l.trigger( 'next' ); }, 100); } } }); $r.carouFredSel({ auto: false, items: 1, prev: { fx: 'cover' }, next: { button: '#next', fx: 'uncover', onBefore: function() { setTimeout(function() { $c.trigger( 'next' ); }, 100); } } });});</script> |
3、在body标签中加入幻灯片整个外部div容器的html代码。
div #carousel-left 是幻灯片左边的容器
div #carousel-center 是幻灯片中间的容器
div #carousel-right 是幻灯片右边的容器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <div id="wrapper"> <div id="carousel-left"> <img src="img/rally4.jpg" width="450" height="325"> <imgsrc="img/rally1.jpg" width="450" height="325"> <img src="img/rally2.jpg"width="450" height="325"> <img src="img/rally3.jpg" width="450" height="325"> </div> <div id="carousel-center"> <img src="img/rally1.jpg" width="550" height="400"> <imgsrc="img/rally2.jpg" width="550" height="400"> <img src="img/rally3.jpg"width="550" height="400"> <img src="img/rally4.jpg" width="550" height="400"> </div> <div id="carousel-right"> <img src="img/rally2.jpg" width="450" height="325"> <imgsrc="img/rally3.jpg" width="450" height="325"> <img src="img/rally4.jpg"width="450" height="325"> <img src="img/rally1.jpg" width="450" height="325"> </div><a id="prev" href="#">?</a> <a id="next" href="#">?</a></div> |
当然还牵涉到一些css样式,我在这就不写出来了,大家可以查看源码中的 Demo.
CoolCarousels的调用js代码我已经在上面写出来了,所以可以配置的参数就从里面找了,无非就是幻灯片播放速度之类的参数,大家自行配制吧。
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com