当前位置:小鱼儿玄机二站 > 操作系统 > jQuery旋转木马式幻灯片轮播特效,基于jQuery完毕

jQuery旋转木马式幻灯片轮播特效,基于jQuery完毕

文章作者:操作系统 上传时间:2019-09-03

本文为大家分享anoSlide是一款超轻型响应式jQuery旋转木马幻灯片插件,它符合在PC端与活动端达成旋转木马幻灯片特效。具体内容如下

本文实例陈说了jQuery完成全自动轮播旋转木马特效。分享给我们供大家参谋。具体如下:
这是一款基于jQuery达成自动轮播旋转木马特效代码,完成进程很轻便。
运营效果图:           -------------------查看效果 下载源码-------------------

特点

图片 1

  • 响应式——适应任何视窗的升幅
  • 掺杂内容
  • 不需要CSS
  • 轻量级(< 8 kb未压缩)
  • 基于jQuery构建
  • 购并图像预加载
  • 回调函数——onConstruct onStart,onEnd
  • 两个可配置选项
  • 推迟加载图片
  • 自行旋转
  • 轻便扩张

不难教程
jquery.caroursel.js是一款非常实用的可自行轮播的jQuery旋转木马插件。该旋转木马将图片展开堆成堆,轮流的将图纸推送到最前面来突显,形成旋转木马的功用。
 应用格局 该jQuery旋转木马插件须求引进jQuery,jquery.carousel.js文件。

jquery实例:anoSlide使用办法

<script src="js/jquery.min.js"></script>
<script src="js/jquery.carousel.js"></script>    

引进核心文件

HTML结构

<script src="js/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.anoslide.js"></script>

该jQuery旋转木马插件使用三个<div>来作为包装成分,在它在那之中是二个冬季列表,用于放置图片,以及八个作为左右导航按键的<div>成分。

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

<div class="caroursel rotator-demo">
 <ul class="rotator-list">
 <li class="rotator-item"><img src="image/1.jpg"></li>
 <li class="rotator-item"><img src="image/2.jpg"></li>
 <li class="rotator-item"><img src="image/3.jpg"></li>
 </ul>
 <div class="rotator-btn rotator-prev-btn"></div>
 <div class="rotator-btn rotator-next-btn"></div>
</div>    
.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;
}

图形的多少需求为奇数张,不然显示会有部分十二分,那是该插件的一个小bug。
CSS样式

jquery旋转木马anoSlide混合展现

您需求为该旋转木马特效增多上面包车型客车片段少不了的CSS样式。

图片 2

.rotator-main {
 position: relative;
 width: 900px;
 height: 400px
}

.rotator-main a, .rotator-main img { display: block; }

.rotator-main .rotator-list {
 width: 900px;
 height: 400px
}

.rotator-main .rotator-list .rotator-item {
 position: absolute;
 left: 0px;
 top: 0px
}

.rotator-main .rotator-btn {
 position: absolute;
 height: 100%;
 width: 100px;
 top: 0px;
 z-index: 10;
 opacity: 0;
}

.rotator-main .rotator-prev-btn {
 left: 0px;
 background: url("../image/btn_l.png") no-repeat center center;
 background-color: red
}

.rotator-main .rotator-next-btn {
 right: 0px;
 background: url("../image/btn_r.png") no-repeat center center;
 background-color: red
}    

JS

早先化插件

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

在页面DOM成分加载实现之后,能够经过上边包车型客车艺术来初步化该旋转木马插件。
Caroursel.init($('.caroursel'))               
若果您必要自定义一些参数,能够在顶层<div>元素中安装data-setting属性。

jquery幻灯片anoSlide多图

<div class="caroursel rotator-main"
  data-setting = '{
  "width":1000,   //旋转木马的宽度
  "height":270,   //旋转木马的高度
  "posterWidth":640, //当前显示的图片的宽度
  "posterHeight":270, //当前显示的图片的高度
  "scale":0.8,   //缩放值
  "algin":"middle",  //对齐方式
  "speed":"1000",  //动画速度
  "isAutoplay":"true", //自动播放
  "dealy":"1000"  //延迟时间
}'>    

图片 3

小提醒:浏览器中只要不可能平常运转,能够尝试切换浏览格局。
为我们大快朵颐的jQuery达成活动轮播旋转木马特效代码如下

JS

<html lang="zh">
<head>
 <meta charset="UTF-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>jQuery自动轮播旋转木马插件</title>
 <link rel="stylesheet" type="text/css" href="css/normalize.css" />
 <link rel="stylesheet" type="text/css" href="css/default.css">
 <link type="text/css" rel="stylesheet" href="css/carousel.css">
 <style type="text/css">
 .caroursel{margin:150px auto;}
 </style>
 <!--[if IE]>
 <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
 <![endif]-->
</head>
<body>
 <article class="htmleaf-container">
 <header class="htmleaf-header">
 <h1>jQuery自动轮播旋转木马插件</h1>

 </header>
 <div class = "caroursel poster-main" data-setting = '{
  "width":1000,
  "height":270,
  "posterWidth":640,
  "posterHeight":270,
  "scale":0.8,
  "dealy":"2000",
  "algin":"middle"
 }'>
  <ul class = "poster-list">
  <li class = "poster-item"><img src="image/1.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/2.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/3.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/4.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/5.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/6.jpg" width = "100%" height="100%"></li>
  <li class = "poster-item"><img src="image/1.jpg" width = "100%" height="100%"></li>
  </ul>
  <div class = "poster-btn poster-prev-btn"></div>
  <div class = "poster-btn poster-next-btn"></div>
 </div>

 </article>

 <script>window.jQuery || document.write('<script src="js/jquery-2.1.1.min.js"></script>')</script>
 <script src="js/jquery.carousel.js"></script>
 <script>
 Caroursel.init($('.caroursel'))
 </script>
</body>
</html>
$('.carousel[data-mixed] ul').anoSlide(
{
  items: 5,
  speed: 500,
  prev: 'a.prev[data-prev]',
  next: 'a.next[data-next]',
  lazy: true,
  delay: 100})

为我们大饱眼福的jQuery完结活动轮播旋转木马特效代码,希望咱们能够欣赏,并选拔到施行中。

HTML

你大概感兴趣的篇章:

  • jQuery旋转木马式幻灯片轮播特效
  • jQuery平滑旋转幻灯片特效代码分享
  • jquery实现的3D旋转木马特效代码分享
  • jQuery实现的制品自动360度旋转显示特效源码分享
  • jQuery右下角旋转环状菜单特效代码
  • 传闻jQuery插件完成环形Logo菜单旋转切换特效
  • jQuery完毕可拖拽3D万花筒筋斗特效
<div class="carousel" data-mixed=""> <a class="prev" data-prev=""></a>
 <ul>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/1.jpg" src="images/slides/1.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/2.jpg" src="images/slides/2.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/3.jpg" src="images/slides/3.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/4.jpg" src="images/slides/4.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/5.jpg" src="images/slides/5.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/6.jpg" src="images/slides/6.jpg"></figure>
   </div>
  </li>
  <li>
   <div class="wrap">
    <figure><img data-src="images/slides/thumbnails/7.jpg" src="images/slides/7.jpg"></figure>
   </div>
  </li>
 </ul>
 <a class="next" data-next=""></a> </div>

jquery旋转木马anoSlide分页

图片 4

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

<div class="carousel">
  <a class="prev"></a>
  <ul>
    <li>Content goes here</li>
    <li>Content goes here</li>
    <li>Content goes here</li>
  </ul>
  <a class="next"></a>
</div>

jquery幻灯片anoSlide标题

图片 5

js

$('.carousel.captions ul').anoSlide(
{
  items: 1,
  speed: 500,
  prev: 'a.prev[data-prev-caption]',
  next: 'a.next[data-next-caption]',
  lazy: true,
  onStart: function(ui)
  {
    /* Remove existing caption in slide */
    ui.slide.element.find('.caption').remove();
  },
  onEnd: function(ui)
  {
    /* Get caption content */
    var content = ui.slide.element.data('caption');

    /* Create a caption wrap element */
    var caption = $('<div/>').addClass('caption').css(
    {
      position: 'absolute', 
      background: 'rgb(0,0,0)',
      color: 'rgb(255,255,255)',
      textShadow: 'rgb(0,0,0) -1px -1px',
      opacity: 0.5,
      top: -100,
      left: 50,
      padding: 20,
      webkitBorderRadius: 5,
      mozBorderRadius: 5,
      borderRadius: 5
    }).html(content);

    /* Append caption to slide and animate it. Animation is really up to you. */
    caption.appendTo(ui.slide.element).animate(
    {
      top:50
    });
  }
})

html

<div class="carousel captions">
  <a class="prev" data-prev-caption></a>
  <ul>
    <li data-caption="Adding captions is really easy">
      <figure><img data-src="images/slides/1.jpg" src="" /></figure>
    </li>
    <li data-caption="anoSlide's callback functions can be used for adding Captions">
      <figure><img data-src="images/slides/2.jpg" src="" /></figure>
    </li>
    <li data-caption="HTML - No problem<br /><br />It's really up to You to decide whether to use HTML or not.">
      <figure><img data-src="images/slides/3.jpg" src="" /></figure>
    </li>
    <li>
      <figure><img data-src="images/slides/4.jpg" src="" /></figure>
    </li>
    <li>
      <figure><img data-src="images/slides/5.jpg" src="" /></figure>
    </li>
    <li>
      <figure><img data-src="images/slides/6.jpg" src="" /></figure>
    </li>
    <li>
      <figure><img data-src="images/slides/7.jpg" src="" /></figure>
    </li>
  </ul>
  <a class="next" data-next-caption></a>
  <a class="badge"></a>
</div>

如上正是有关jQuery旋转木马式幻灯片轮播特效,希望对我们的求学抱有扶助。

你大概感兴趣的稿子:

  • 依赖jQuery实现机关轮播旋转木马特效
  • jQuery平滑旋转幻灯片特效代码分享
  • jquery落成的3D旋转木马特效代码分享
  • jQuery达成的产品自动360度旋转体现特效源码分享
  • jQuery右下角旋转环状菜单特效代码
  • 依赖jQuery插件完结环形Logo菜单旋转切换特效
  • jQuery实现可拖拽3D万花筒转悠特效

本文由小鱼儿玄机二站发布于操作系统,转载请注明出处:jQuery旋转木马式幻灯片轮播特效,基于jQuery完毕

关键词: