JS 实现3D立体效果的首页轮播图(瞬间让你的网站高大上,逼格满满)-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

JS 实现3D立体效果的首页轮播图(瞬间让你的网站高大上,逼格满满)

简介:

这里写图片描述

还是那句话,废话少说,直接上源代码:http://download.csdn.net/detail/cometwo/9387901

<html>
<head>
<title>JS 实现3D立体效果的图片幻灯切换</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
html {background:#000}
body, ul {margin:0;padding:0}
li {list-style:none}
img {border:none;display:block}
.slide-wp {
width: 500px;
height: 300px;
overflow: hidden;
position: absolute;
left: 50%;
top: 50%;
margin-left: -250px;
margin-top: -150px;
}
.nav-wp {
position: absolute;
background: #ccc;
top: 50%;
margin-top: 170px;
left: 50%;
margin-left: -100px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
padding: 0 20px 6px 10px;
_padding: 0 20px 2px 10px;
}
.nav li {
float: left;
margin-left: 10px;
font-size: 20px;
font-weight: bold;
font-family: tahoma;
color: #22739e;
cursor: pointer;
height: 22px;
}
.nav li.cur{color: #ff7a00}
.next {
position:absolute;
top: 0;
left: 160px;
padding: 4px 8px;
color: #ff7a00;
background: #ccc;
height: 20px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
cursor: pointer;
}
</style>
</head>
<body>
<h2 style="color:#fff">对于使用IE6的同学看到的斑点,我只能表示很无奈。。。</h2>
<div id="slider" class="slide-wp">
<ul>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/1.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/2.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/3.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/4.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/5.jpg"  alt="" /></a></li>
</ul>
</div>
<div class="nav-wp">
<ul id="nav" class="nav">
<li onclick="mySlider.pos(0)"></li>
<li onclick="mySlider.pos(1)"></li>
<li onclick="mySlider.pos(2)"></li>
<li onclick="mySlider.pos(3)"></li>
<li onclick="mySlider.pos(4)"></li>
</ul>
<a class="next" onclick="mySlider.move()">next</a>
</div>
<script type="text/javascript">
var HR = {
 $ : function(i) {return document.getElementById(i)},
 $$ : function(c, p) {return p.getElementsByTagName(c)},
 ce : function(i, t) {
  var o = document.createElement(i);
  t.appendChild(o);
  return o;
 }
};
HR.slider3D = function () {
 var init = function (o) {
  this.o = o;
  var wp = HR.$(o.id), ul = HR.$$('ul', wp)[0], li = this.li = HR.$$('li', ul);
  this.l = li.length;
  this.w = wp.offsetWidth;
  this.h = wp.offsetHeight;
  this.at = o.auto? o.auto : 4;
  var con = this.con = HR.ce('div', wp);
  con.style.cssText = 'position:absolute;left:0;top:0;width:'+this.w+'px;height:'+this.h+'px';
  ul.style['display'] = 'none'; 
  this.a1 = HR.ce('a', con); 
  this.a1.style.cssText = 'position:absolute;left:0;top:0;overflow:hidden'; 
  this.a2 = HR.ce('a', con);
  this.a2.style.cssText = 'position:absolute;top:0;right:0;overflow:hidden';
  this.a1.innerHTML = this.a2.innerHTML = '<img alt="" />';
  this.img = HR.$$('img', ul);
  this.s = o.maskSize ? o.maskSize : 5;

  this.mask11 = HR.ce('span', this.a1);
  this.mask12 = HR.ce('span', this.a1);
  this.mask21 = HR.ce('span', this.a2);
  this.mask22 = HR.ce('span', this.a2);

  this.pos(0);
 }
 init.prototype = {
  pos : function (i) {
   clearInterval(this.li[i].a); clearInterval(this.au); this.au = 0; this.cur = i;
   var navli = HR.$$('li', HR.$(this.o.navId));
   for (var j=0; j<navli.length; j++) {
    navli[j].className = i == j ? 'cur' : '';
   }
   var img1 = HR.$$('img', this.a1)[0], img2 = HR.$$('img', this.a2)[0], _this = this;
   img1.src = i==0 ? this.img[this.l-1].src : this.img[i-1].src;
   img1.width = this.w;
   img2.src = this.img[i].src;
   img2.width = 0;
   img1.height = img2.height = this.h;
   this.mask11.style.cssText = 'position:absolute;left:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black transparent transparent black;border-style:solid dashed dashed solid;border-width:0 '+this.w/2+'px';
   this.mask12.style.cssText = 'position:absolute;left:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent transparent black black;border-style:dashed dashed solid solid;border-width:0 '+this.w/2+'px';
   this.mask21.style.cssText = 'position:absolute;right:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black black transparent transparent;border-style:solid solid dashed dashed;border-width:0px';
   this.mask22.style.cssText = 'position:absolute;right:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent black black transparent;border-style:dashed solid solid dashed;border-width:0px';
   this.li[i].a = setInterval(function(){_this.anim(i)}, 20);
  },
  anim : function (i) {
   var w1 = HR.$$('img', this.a1)[0].width, w2  = HR.$$('img', this.a2)[0].width;
   if (w2 == this.w) {
    clearInterval(this.li[i].a);
    HR.$$('img', this.a1)[0].width = 0;
    HR.$$('img', this.a2)[0].width = this.w;
    this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = '0px';
    this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = this.h/this.s + 'px';
    this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = this.w/2 + 'px';
    this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = '0px';
   }else {
    HR.$$('img', this.a1)[0].width -= Math.ceil((this.w-w2)*.13);
    HR.$$('img', this.a2)[0].width += Math.ceil((this.w-w2)*.13);
    this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = HR.$$('img', this.a1)[0].width/2 + 'px';
    this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = HR.$$('img', this.a2)[0].width*this.h/(this.s*this.w) + 'px';
    this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = HR.$$('img', this.a2)[0].width/2 + 'px';
    this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = this.h/this.s - HR.$$('img', this.a2)[0].width*this.h/(this.s*this.w) + 'px';
    if (!this.au) this.auto();
   }
  },
  auto : function () {
   var _this = this;
   this.au = setInterval(function(){_this.move()}, this.at*1000);
  },
  move : function () {
   var n = this.cur==this.l-1 ? 0 : this.cur+1;
   this.pos(n);
  }
 }
 return init;
}();
var mySlider = new HR.slider3D({
 id: 'slider',
 maskSize: 6,
 navId: 'nav',
 auto: 4
})</SCRIPT></body>
</html>

高级扩展

这里写图片描述

 <html>
    <head>
        <title>JS 实现3D立体效果的图片幻灯切换</title>
        <meta charset="utf-8" />
        <style>
            html {
                background: #000
            }

            body,
            ul {
                left: 0px;
                top: 0px;
                margin: 0;
                padding: 0
            }
            h1{
                border: 1px solid blue;
                text-align: center;
                color:red;
                padding: 10px;
                font-size: 25px;
            }
            li,a,img {
                display: block;
                list-style: none;
                border: none;
            }
            .slide-wp {
                height: 400px;
                width:100%;
                overflow: hidden;
                position: relative;
                margin: 0 auto;
                border: 1px solid red;
            }
            .slide-wp ul {
                position: relative;
            }





            .nav-wp {
                position: absolute;
                background: #ccc;
                top: 50%;
                margin-top: 170px;
                left: 50%;
                margin-left: -100px;
                border-radius: 4px;
                -moz-border-radius: 4px;
                -webkit-border-radius: 4px;
                padding: 0 20px 6px 10px;
                _padding: 0 20px 2px 10px;
            }

            .nav li {
                float: left;
                margin-left: 10px;
                font-size: 20px;
                font-weight: bold;
                font-family: tahoma;
                color: blue;      /*默认颜色*/
                cursor: pointer;
                height:20px;
            }

            .nav li.cur {
                color: red;      
            }

            .next {
                position: absolute;
                top: 0;
                left: 160px;
                padding: 4px 8px;
                color: #ff7a00;
                background: #ccc;
                height: 20px;
                border-radius: 4px;
                -moz-border-radius: 4px;
                -webkit-border-radius: 4px;
                cursor: pointer;
            }
        </style>
    </head>

    <body>
        <h1>IE6可能不支持</h1>
        <div id="slider" class="slide-wp">
            <ul>
                <li>
                    <a href="http://www.newxing.com/" target="_blank"><img src="img/img1.jpg" alt="" /></a>
                </li>
                <li>
                    <a href="http://www.newxing.com/" target="_blank"><img src="img/img2.jpg" alt="" /></a>
                </li>
                <li>
                    <a href="http://www.newxing.com/" target="_blank"><img src="img/img3.jpg" alt="" /></a>
                </li>
                <li>
                    <a href="http://www.newxing.com/" target="_blank"><img src="img/img4.jpg" alt="" /></a>
                </li>
                <li>
                    <a href="http://www.newxing.com/" target="_blank"><img src="img/img5.jpg" alt="" /></a>
                </li>
            </ul>
        </div>
        <div class="nav-wp">
            <ul id="nav" class="nav">
                <li onclick="mySlider.pos(0)"></li>
                <li onclick="mySlider.pos(1)"></li>
                <li onclick="mySlider.pos(2)"></li>
                <li onclick="mySlider.pos(3)"></li>
                <li onclick="mySlider.pos(4)"></li>
            </ul>
            <a class="next" onclick="mySlider.move()">next</a>
        </div>





        <script type="text/javascript">
            var HR = {
                $: function(i) {
                    return document.getElementById(i)
                },
                $$: function(c, p) {
					return p.getElementsByTagName(c)
				},
				ce: function(i, t) {
					var o = document.createElement(i);
					t.appendChild(o);
					return o;
				}
			};
			HR.slider3D = function() {
				var init = function(o) {
					this.o = o;
					var wp = HR.$(o.id),
						ul = HR.$$('ul', wp)[0],
						li = this.li = HR.$$('li', ul);
					this.l = li.length;
					this.w = wp.offsetWidth;
					this.h = wp.offsetHeight;
					this.at = o.auto ? o.auto : 4;
					var con = this.con = HR.ce('div', wp);
					con.style.cssText = 'position:absolute;left:0;top:0;width:' + this.w + 'px;height:' + this.h + 'px';
					ul.style['display'] = 'none';
					this.a1 = HR.ce('a', con);
					this.a1.style.cssText = 'position:absolute;left:0;top:0;overflow:hidden';
					this.a2 = HR.ce('a', con);
					this.a2.style.cssText = 'position:absolute;top:0;right:0;overflow:hidden';
					this.a1.innerHTML = this.a2.innerHTML = '<img alt="" />';
					this.img = HR.$$('img', ul);
					this.s = o.maskSize ? o.maskSize : 5;
					this.mask11 = HR.ce('span', this.a1);
					this.mask12 = HR.ce('span', this.a1);
					this.mask21 = HR.ce('span', this.a2);
					this.mask22 = HR.ce('span', this.a2);
					this.pos(0);
				}
				init.prototype = {
					pos: function(i) {
						clearInterval(this.li[i].a);
						clearInterval(this.au);
						this.au = 0;
						this.cur = i;
						var navli = HR.$$('li', HR.$(this.o.navId));
						for (var j = 0; j < navli.length; j++) {
							navli[j].className = i == j ? 'cur' : '';
						}
						var img1 = HR.$$('img', this.a1)[0],
							img2 = HR.$$('img', this.a2)[0],
							_this = this;
						img1.src = i == 0 ? this.img[this.l - 1].src : this.img[i - 1].src;
						img1.width = this.w;
						img2.src = this.img[i].src;
						img2.width = 0;
						img1.height = img2.height = this.h;
						this.mask11.style.cssText = 'position:absolute;left:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black transparent transparent black;border-style:solid dashed dashed solid;border-width:0 ' + this.w / 2 + 'px';
						this.mask12.style.cssText = 'position:absolute;left:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent transparent black black;border-style:dashed dashed solid solid;border-width:0 ' + this.w / 2 + 'px';
						this.mask21.style.cssText = 'position:absolute;right:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black black transparent transparent;border-style:solid solid dashed dashed;border-width:0px';
						this.mask22.style.cssText = 'position:absolute;right:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent black black transparent;border-style:dashed solid solid dashed;border-width:0px';
						this.li[i].a = setInterval(function() {
							_this.anim(i)
						}, 20);   //规定多长时间完成翻转
					},
					anim: function(i) {
						var w1 = HR.$$('img', this.a1)[0].width,
							w2 = HR.$$('img', this.a2)[0].width;
						if (w2 == this.w) {
							clearInterval(this.li[i].a);
							HR.$$('img', this.a1)[0].width = 0;
							HR.$$('img', this.a2)[0].width = this.w;
							this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = '0px';
							this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = this.h / this.s + 'px';
							this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = this.w / 2 + 'px';
							this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = '0px';
						} else {
							HR.$$('img', this.a1)[0].width -= Math.ceil((this.w - w2) * .13);
							HR.$$('img', this.a2)[0].width += Math.ceil((this.w - w2) * .13);
							this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = HR.$$('img', this.a1)[0].width / 2 + 'px';
							this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = HR.$$('img', this.a2)[0].width * this.h / (this.s * this.w) + 'px';
							this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = HR.$$('img', this.a2)[0].width / 2 + 'px';
							this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = this.h / this.s - HR.$$('img', this.a2)[0].width * this.h / (this.s * this.w) + 'px';
                            if (!this.au) this.auto();
                        }
                    },
                    auto: function() {
                        var _this = this;
                        this.au = setInterval(function() {
                            _this.move()
                        }, this.at * 1000);   //翻转频率,看150行
                    },
                    move: function() {
                        var n = this.cur == this.l - 1 ? 0 : this.cur + 1;
                        this.pos(n);
                    }
                }
                return init;
            }();
            var mySlider = new HR.slider3D({
                id: 'slider',
                maskSize: 6,     //banner图张数
                navId: 'nav',
                auto: 1        //设置翻转频率,看150行
            })
        </SCRIPT>
    </body>

</html>

这里写图片描述

<!DOCTYPE HTML>
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>全屏图片切换</title>
        <script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
        <script type="text/javascript" src="js/jquery.flexslider-min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.flexslider').flexslider({
                    directionNav: true,
                    pauseOnAction: false,
                    animation: "slide",
                    slideshowSpeed: 700
                });
            });
        </script>
        <style type="text/css">
            * {
                margin: 0;
                padding: 0;
                list-style-type: none;
            }

            a,
            img {
                border: 0;
            }

            body {
                font: 12px/180% Arial, Helvetica, sans-serif, "新宋体";
            }
            /* flexslider */

            .flexslider {
                position: relative;
                height: 400px;
                width: 100%;
                overflow: hidden;
                background: url(img/loading.gif) 50% no-repeat;
                margin: 0 auto;
            }

            .slides {
                position: relative;
                z-index: 1;
            }

            .slides li {
                height: 600px;
            }
             .flex-control-nav {
                position: absolute;
                bottom: 10px;
                z-index: 2;
                width: 100%;
                text-align: center;
            }

            .flex-control-nav li {
                display: inline-block;
                width: 14px;
                height: 14px;
                margin: 0 5px;
                *display: inline;
                zoom: 1;
            }

            .flex-control-nav a {
                display: inline-block;
                width: 14px;
                height: 14px;
                line-height: 40px;
                overflow: hidden;
                background: url(img/dot.png) right 0 no-repeat;
                cursor: pointer;
            }

            .flex-control-nav .flex-active {
                background-position: 0 0;
            }

            .flex-direction-nav {
                position: absolute;
                z-index: 3;
                width: 100%;
                top: 45%;
            }

            .flex-direction-nav li a {
                display: block;
                width: 50px;
                height: 50px;
                overflow: hidden;
                cursor: pointer;
                position: absolute;
            }

            .flex-direction-nav li a.flex-prev {
                left: 40px;
                background: url(img/prev.png) center center no-repeat;
            }

            .flex-direction-nav li a.flex-next {
                right: 40px;
                background: url(img/next.png) center center no-repeat;
            } 
        </style>
    </head>

    <body>

        <div style="height:20px;overflow:hidden;">banner图</div>

        <div class="flexslider">
            <ul class="slides">
                <li style="background:url(img/img1.jpg) 50% 0 no-repeat;"></li>
                <li style="background:url(img/img2.jpg) 50% 0 no-repeat;"></li>
                <li style="background:url(img/img3.jpg) 50% 0 no-repeat;"></li>
                <li style="background:url(img/img4.jpg) 50% 0 no-repeat;"></li>
                <li style="background:url(img/img5.jpg) 50% 0 no-repeat;"></li>
            </ul>
        </div>
        <pre>
 $(window).load(function() {
 $('.flexslider').flexslider({
  animation: "fade",              //String: Select your animation type, "fade" or "slide"                  图片变换方式:淡入淡出或者滑动
  slideDirection: "horizontal",   //String: Select the sliding direction, "horizontal" or "vertical"          图片设置为滑动式时的滑动方向:左右或者上下
  slideshow: true,                //Boolean: Animate slider automatically                                  载入页面时,是否自动播放
  slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds         自动播放速度毫秒
  animationDuration: 600,         //Integer: Set the speed of animations, in milliseconds                  动画淡入淡出效果延时
  directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)          是否显示左右控制按钮
  controlNav: true,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage              是否显示控制菜单
  keyboardNav: true,              //Boolean: Allow slider navigating via keyboard left/right keys                       键盘左右方向键控制图片滑动
  mousewheel: false,              //Boolean: Allow slider navigating via mousewheel                        鼠标滚轮控制制图片滑动
  prevText: "Previous",           //String: Set the text for the "previous" directionNav item              设置文本的字符串:“以前的”directionnav项目
  nextText: "Next",               //String: Set the text for the "next" directionNav item                   看过《文本字符串:“下”的directionnav item
  pausePlay: false,               //Boolean: Create pause/play dynamic element                              布尔:create暂停/播放动态元素
  pauseText: 'Pause',             //String: Set the text for the "pause" pausePlay item                     字符串:设置文字为“暂停”pauseplay项目
  playText: 'Play',               //String: Set the text for the "play" pausePlay item                      字符串:在“玩”pauseplay项设置文本
  randomize: false,               //Boolean: Randomize slide order                                          是否随即幻灯片
  slideToStart: 0,                //Integer: The slide that the slider should start on. Array notation (0 = first slide)初始化第一次显示图片位置
  animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end            是否循环滚动
  pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.                              布尔:暂停幻灯片的控制要素互动的时候,强烈推荐。
  pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering                         布尔:暂停幻灯片演示当鼠标悬停的滑块,然后恢复时不再徘徊
  controlsContainer: "",          //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.                  该导航元素的容器说,这应该是appended太。默认的容器是flexslider元。实例的使用将是“容器”,# .flexslider“容器”,等等。如果没有发现了元素的默认行为,将被考虑。
  manualControls: "",             //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.自定义控制导航
  manualControlEvent:"",          //String:自定义导航控制触发事件:默认是click,可以设定hover
  start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide                                       回调:功能(滑块)-当滑块加载第一个幻灯片时触发
  before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation                              回调:功能(滑块)-与每个滑块动画异步触发
  after: function(){},            //Callback: function(slider) - Fires after each slider animation completes                                  回调:功能(滑块)-每个滑块动画完成后触发
  end: function(){}               //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)                  当滑块到达上一个幻灯片(异步)时发生火灾
 });
});
 </pre>

    </body>

</html>

配置参数

        <pre>
 $(window).load(function() {
 $('.flexslider').flexslider({
  animation: "fade",              //String: Select your animation type, "fade" or "slide"                  图片变换方式:淡入淡出或者滑动
  slideDirection: "horizontal",   //String: Select the sliding direction, "horizontal" or "vertical"          图片设置为滑动式时的滑动方向:左右或者上下
  slideshow: true,                //Boolean: Animate slider automatically                                  载入页面时,是否自动播放
  slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds         自动播放速度毫秒
  animationDuration: 600,         //Integer: Set the speed of animations, in milliseconds                  动画淡入淡出效果延时
  directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)          是否显示左右控制按钮
  controlNav: true,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage              是否显示控制菜单
  keyboardNav: true,              //Boolean: Allow slider navigating via keyboard left/right keys                       键盘左右方向键控制图片滑动
  mousewheel: false,              //Boolean: Allow slider navigating via mousewheel                        鼠标滚轮控制制图片滑动
  prevText: "Previous",           //String: Set the text for the "previous" directionNav item              设置文本的字符串:“以前的”directionnav项目
  nextText: "Next",               //String: Set the text for the "next" directionNav item                   看过《文本字符串:“下”的directionnav item
  pausePlay: false,               //Boolean: Create pause/play dynamic element                              布尔:create暂停/播放动态元素
  pauseText: 'Pause',             //String: Set the text for the "pause" pausePlay item                     字符串:设置文字为“暂停”pauseplay项目
  playText: 'Play',               //String: Set the text for the "play" pausePlay item                      字符串:在“玩”pauseplay项设置文本
  randomize: false,               //Boolean: Randomize slide order                                          是否随即幻灯片
  slideToStart: 0,                //Integer: The slide that the slider should start on. Array notation (0 = first slide)初始化第一次显示图片位置
  animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end            是否循环滚动
  pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.                              布尔:暂停幻灯片的控制要素互动的时候,强烈推荐。
  pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering                         布尔:暂停幻灯片演示当鼠标悬停的滑块,然后恢复时不再徘徊
  controlsContainer: "",          //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.                  该导航元素的容器说,这应该是appended太。默认的容器是flexslider元。实例的使用将是“容器”,# .flexslider“容器”,等等。如果没有发现了元素的默认行为,将被考虑。
  manualControls: "",             //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.自定义控制导航
  manualControlEvent:"",          //String:自定义导航控制触发事件:默认是click,可以设定hover
  start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide                                       回调:功能(滑块)-当滑块加载第一个幻灯片时触发
  before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation                              回调:功能(滑块)-与每个滑块动画异步触发
  after: function(){},            //Callback: function(slider) - Fires after each slider animation completes                                  回调:功能(滑块)-每个滑块动画完成后触发
  end: function(){}               //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)                  当滑块到达上一个幻灯片(异步)时发生火灾
 });
});
 </pre>

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章
最新文章
相关文章