jQuery旋转木马式幻灯片轮播特效

响应式——适应任何视窗的宽度

混合内容

不需要CSS

轻量级(< 8 kb未压缩)

基于jQuery构建

集成图像预加载

回调函数——onConstruct onStart,onEnd

多个可配置选项

延迟加载图片

自动旋转

容易扩展

jquery实例:anoSlide使用方法

引入核心文件

<script src="https://www.jb51.net/js/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="https://www.jb51.net/js/jquery.anoslide.js"></script>

写入基础CSS样式,可根据项目完全自定义

.carousel { position: relative; min-height: 20px; height: auto !important; height: 20px; background: url(images/loader.gif) center center no-repeat; } .carousel .next, .carousel .prev { display: none; width: 56px; height: 56px; position: absolute; bottom: 20px; left: 50%; margin-top: -28px; z-index: 9999; cursor: pointer; } .carousel .prev { margin-left: -60px; background: url(images/prev.png) 0 0 no-repeat; } .carousel .next { margin-right: -60px; background: url(images/next.png) 0 0 no-repeat; } .carousel li { display: none; } .carousel li img { width: 100%; height: auto; } .paging { position: absolute; z-index: 9998; } .paging > a { display: block; cursor: pointer; width: 40px; height: 40px; float: left; background: url(images/dots.png) 0px -40px no-repeat; } .paging > a:hover, .paging > a.current { background: url(images/dots.png) 0px 0px no-repeat; } .badge { display: block; width: 104px; height: 104px; background: url(images/badge.png) 0 0 no-repeat; z-index: 9000; position: absolute; top: -3px; left: -3px; } img { -webkit-user-select: none; /* Chrome all / Safari all */ -moz-user-select: none; /* Firefox all */ -ms-user-select: none; /* IE 10+ */ -o-user-select: none; user-select: none; }

jquery旋转木马anoSlide混合显示

jQuery旋转木马式幻灯片轮播特效


JS

$('.carousel ul').anoSlide( { items: 1, speed: 500, prev: 'a.prev', next: 'a.next', lazy: true, auto: 4000 }) html <div> <a></a> <ul> <li>Content goes here</li> <li>Content goes here</li> <li>Content goes here</li> </ul> <a></a> </div>

jquery幻灯片anoSlide多图

jQuery旋转木马式幻灯片轮播特效

JS

$('.carousel[data-mixed] ul').anoSlide( { items: 5, speed: 500, prev: 'a.prev[data-prev]', next: 'a.next[data-next]', lazy: true, delay: 100})

HTML

<div data-mixed=""> <a data-prev=""></a> <ul> <li> <div> <figure><img data-src="images/slides/thumbnails/1.jpg" src="https://www.jb51.net/images/slides/1.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/2.jpg" src="https://www.jb51.net/images/slides/2.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/3.jpg" src="https://www.jb51.net/images/slides/3.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/4.jpg" src="https://www.jb51.net/images/slides/4.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/5.jpg" src="https://www.jb51.net/images/slides/5.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/6.jpg" src="https://www.jb51.net/images/slides/6.jpg"></figure> </div> </li> <li> <div> <figure><img data-src="images/slides/thumbnails/7.jpg" src="https://www.jb51.net/images/slides/7.jpg"></figure> </div> </li> </ul> <a data-next=""></a> </div>

jquery旋转木马anoSlide分页

jQuery旋转木马式幻灯片轮播特效

js

$('.carousel ul').anoSlide( { items: 1, speed: 500, prev: 'a.prev[data-prev-paging]', next: 'a.next[data-next-paging]', lazy: true, onConstruct: function(instance) { var paging = $('<div/>').addClass('paging fix').css( { position: 'absolute', top: 1, left:50 + '%', width: instance.slides.length * 40, marginLeft: -(instance.slides.length * 40)/2 }) /* Build paging */ for (i = 0, l = instance.slides.length; i < l; i++) { var a = $('<a/>').data('index', i).appendTo(paging).on( { click: function() { instance.stop().go($(this).data('index')); } }); if (i == instance.current) { a.addClass('current'); } } instance.element.parent().append(paging); }, onStart: function(ui) { var paging = $('.paging'); paging.find('a').eq(ui.instance.current).addClass('current').siblings().removeClass('current'); } })

html

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzzwp.html