jQuery自动播放动画滑块幻灯片



96 380 127



特效描述:jQuery 自动播放 动画滑块幻灯片,jQuery自动播放动画滑块幻灯片

代码结构

1. 引入CSS

<link rel="stylesheet" href="libs/css/code09.css">
<link rel="stylesheet" href="code/codeslider.css">
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Raleway:100,400,700,900'>

2. 引入JS

<script src="libs/scripts/modernizr.js"></script>
<script src="libs/scripts/jquery-1.10.2.min.js"></script>
<script src="libs/scripts/code09.js"></script>
<script src="code/codeslider.js"></script>

3. HTML代码

    <!-- Slider layer - begin
    ============================================================== -->
    <div class="wrapper">
    <div class="">
        <div class="cs cs-default nav-hide bg-dark" data-slider="responsive-1156 media-940-960-1281 media-748-768-959 mCanvas-20 speed-600 isLoop-off isNav-on isKeyboard-on numCur-0">
            <!-- Slide 1 - begin -->
            <div>
                <a class="cs-img" href="imgs/slider/trans.png" style="background-color: #fa0">[bg]</a>
                <div data-layer="xy-bottomOut; x-center y-206 start-500;">
                    <a class="cs-img" href="imgs/slider/cs_logo.png">[logo]</a>
                </div>
                <div data-layer="xy-bottomOut width-504; x-center y-305 start-800;" class="line1"></div>
                <div class="show-desktop" data-layer="xy-bottomOut; x-center y-320 start-1000;">
                    <span style="font-size: 14px;">on code - multi slider</span>
                </div>
                <!-- Texture matrix -->
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-ra start-0 speed-10000 es-linear; x-0 y-ra start-500 speed-10000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-20000 es-linear; x-100 y--1000 start-500 speed-20000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-1 start-0 speed-30000 es-linear; x-200 y-ra start-500 speed-30000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-30000 es-linear; x-300 y--500 start-500 speed-30000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-1 start-0 speed-20000 es-linear; x-400 y-ra start-500 speed-20000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-10000 es-linear; x-500 y--800 start-500 speed-10000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-1 start-0 speed-20000 es-linear; x-600 y-ra start-500 speed-20000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-10000 es-linear; x-700 y--1000 start-500 speed-10000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-1 start-0 speed-20000 es-linear; x-800 y-ra start-500 speed-20000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-30000 es-linear; x-900 y--500 start-500 speed-30000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-topOut opacity-1 start-0 speed-20000 es-linear; x-1000 y-ra start-500 speed-20000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
                <a  data-layer="
                    count-infinite direction-alternate
                    xy-bottomOut opacity-1 start-0 speed-10000 es-linear; x-1100 y--500 start-500 speed-10000;"
                    class="cs-img" href="imgs/slider/texture_matrix.png">[texture]</a>
            </div>
            <!-- Slide 1 - end -->
            <!-- Slide 2 - begin -->
            <div data-slide="delay-13000">
                <a class="cs-img" href="imgs/slider/trans.png" style="background-color: #c2d900">[bg]</a>
                <!-- Intro -->
                <h1 data-layer="
                    scale-4;
                    x-center y--38 scale-1 start-200 speed-200;
                    xy-topOut opacity-1 start-500 speed-200;"
                    class="text thin f500">3</h1>
                <h1 data-layer="
                    xy-bottomOut;
                    x-center y-center start-700 speed-200;
                    xy-topOut opacity-1 start-500 speed-200;"
                    class="text thin f200">LAYOUT</h1>
                <!-- Preview: ipad -->
                <a  data-layer="
                    xy-bottomOut;
                    x-center y-center start-1500 speed-400;
                    xy-rightOut start-1800 speed-200;
                    x-center y-center opacity-0 scale-0.2 start-0 speed-0;   -> time-3300
                    opacity-1 scale-1 start-500 speed-200;
                    scale-4 start-2900 speed-200;
                    "
                    class="cs-img" href="imgs/slider/ipad_green.png">[ipad]</a>
                <a  data-layer="
                    ;
                    x-251 y-center start-1900 speed-0;
                    xy-rightOut start-1400 speed-0;
                    x-251 y-center start-900 speed-0;
                    start-1800 speed-0;
                    "
                    class="cs-img" style="z-index: 1" href="imgs/slider/ipad_edgeleft.png">[edge left]</a>
                <a  data-layer="
                    ;
                    x-845 y-center start-1900 speed-0;
                    xy-rihgtOut start-1400 speed-0;
                    "
                    class="cs-img" style="z-index: 1" href="imgs/slider/ipad_edgeright.png">[edge right]</a>
                <!-- Preview: image layout line -->
                <a  data-layer="
                    xy-leftOut;
                    x-center y-center start-1500 speed-400;
                    x-845 start-800 speed-800 opacity-0.5;
                    xy-rightOut start-1000 speed-200;
                    x-center y-center opacity-0 scale-0.2 start-0 speed-0; -> time-3300
                    opacity-1 scale-1 start-700 speed-200;
                    opacity-0.5 start-1000 speed-1000;
                    scale-4 start-1500 speed-200;
                    "
                    class="cs-img" href="imgs/slider/layout_img0.jpg">[img0]</a>
                <a  data-layer="
                    xy-leftOut;
                    x--223 y-center opacity-0.5 start-1700 speed-400;
                    x-center opacity-1 start-600 speed-800;
                    xy-rightOut start-1000 speed-200;"
                    class="cs-img" href="imgs/slider/layout_img1.jpg">[img1]</a>
                <!-- Preview : image layout dot -->
                <a  data-layer="
                    xy-topOut;
                    x-73 y-center start-4200 speed-200;
                    x-667 opacity-1 start-800 speed-800;
                    x-right scale-4 start-1300 speed-200;
                    "
                    class="cs-img" href="imgs/slider/layout_img3a.jpg">[img3a]</a>
                <a  data-layer="
                    xy-bottomOut;
                    x--109 y-center start-4300 speed-200;
                    x-489 opacity-1 start-900 speed-700;
                    scale-4 start-1100 speed-200;
                    "
                    class="cs-img" href="imgs/slider/layout_img3b.jpg">[img3b]</a>
                <a  data-layer="
                    xy-topOut;
                    x--291 y-center start-4400 speed-200;
                    x-311 opacity-1 start-1000 speed-600;
                    x-left scale-4 start-900 speed-200;
                    "
                    class="cs-img" href="imgs/slider/layout_img3c.jpg">[img3c]</a>
                <!-- Preview : image layout custom -->
                <a  data-layer="
                    scale-4;
                    x-center y-center scale-1 start-7100 speed-200;
                    xy-bottomOut start-1800 speed-200;
                    "
                    class="cs-img img-box z4" href="imgs/slider/layout_img4.jpg">[img custom]</a>
                <a  data-layer="
                    x-center y-center;
                    rotate-10 start-7500 speed-800;
                    x--50 y-150 opacity-1 rotate--45 scale-0.65 start-800 speed-400;
                    xy-leftOut rotate-0 start-600 speed-200;
                    "
                    class="cs-img img-box z3" href="imgs/slider/layout_img5.jpg">[img custom]</a>
                <a  data-layer="
                    x-center y-center;
                    rotate--10 start-7500 speed-800;
                    x-800 y--100 rotate-45 scale-0.4 start-800 speed-400;
                    xy-topOut rotate-0 start-600 speed-200;
                    "
                    class="cs-img img-box z2" href="imgs/slider/layout_img6.jpg">[img custom]</a>
                <a  data-layer="
                    x-center y-center;
                    rotate-15 start-7500 speed-800;
                    x-830 y-200 rotate-60 scale-0.5 start-800 speed-400;
                    xy-rightOut rotate-0 start-600 speed-200;
                    "
                    class="cs-img img-box z1" href="imgs/slider/layout_img7.jpg">[img custom]</a>
                <!-- End animation -->
                <h1 data-layer="
                    xy-leftOut;
                    x-100 y-82 skew-15 start-9100 speed-200 es-easeOutQuint;
                    opacity-1 skew-0 start-300 speed-100 es-easeOutExpo;
                    "
                    class="text thin f200">3</h1>
                <h1 data-layer="
                    xy-rightOut;
                    x-230 y-110 skew-15 start-9200 speed-200 es-easeOutQuint;
                    opacity-1 skew-0 start-200 speed-100 es-easeOutExpo;
                    "
                    class="text thin f200">LAYOUT</h1>
                <a  data-layer="
                    x-161 y-343 start-9400 speed-1000;"
                    class="cs-img" href="imgs/slider/layout_line.png">[layout line]</a>
                <a  data-layer="
                    x-480 y-343 start-9900 speed-1000;"
                    class="cs-img" href="imgs/slider/layout_dot.png">[layout dot]</a>
                <a  data-layer="
                    x-763 y-338 start-10400 speed-1000;"
                    class="cs-img" href="imgs/slider/layout_custom.png">[layout custom]</a>
                <div data-layer="height-67 x-445 y-343 start-9600 speed-200" class="line2"></div>
                <div data-layer="height-67 x-722 y-343 start-10300 speed-200" class="line2"></div>
            </div>
            <!-- Slide 2 - end -->
            <!-- Slide 3 - begin -->
            <div>
                <a class="cs-img" href="imgs/slider/trans.png" style="background-color: #00dcd2">[bg]</a>
                <!-- Typography -->
                <h1 data-layer="
                    scale-0.2;
                    x-center y-180 scale-1 start-200 speed-500;
                    x-200 start-700 speed-200;
                    x-280 start-200 speed-200;
                    x-center start-100 speed-200;
                    scale-6 start-200 speed-200 opacity-0;
                    x-0 y-center scale-1 start-6000 speed-0;
                    xy-topOut start-0 opacity-1;
                    y-65 start-200 speed-800 opacity-1 es-easeOutExpo;
                    "
                    class="text thin f120">RESPONSIVE</h1>
                <h1 data-layer="
                    scale-0.2;
                    x-center y-180 scale-1 start-2000 speed-500;
                    scale-1.5 start-700 speed-200;
                    scale-0.5 start-200 speed-200;
                    scale-1 start-100 speed-200;
                    scale-6 start-200 speed-200 opacity-0;
                    x-0 y-165 scale-1 start-4000 speed-0;
                    xy-leftOut start-0 speed-0 opacity-1;
                    x-0 start-300 speed-800 opacity-1 es-easeOutExpo;
                    "
                    class="text ul-bold f120">IMAGE</h1>
                <h1 data-layer="
                    scale-0.2;
                    x-center y-180 scale-1 start-4000 speed-500;
                    rotate-25 start-700 speed-200;
                    rotate--45 start-200 speed-200;
                    rotate-0 start-100 speed-200;
                    scale-6 start-200 speed-200 opacity-0;
                    x-0 y-265 scale-1 start-2000 speed-0;
                    xy-rightOut start-0 speed-0 opacity-1;
                    x-0 start-400 speed-800 opacity-1 es-easeOutExpo;
                    "
                    class="text f120">SLIDESHOW</h1>
                <h1 data-layer="
                    scale-0.2;
                    x-center y-180 scale-1 start-6000 speed-500;
                    opacity-0 skew-30 start-700 speed-200;
                    opacity-1 skew--30 start-100 speed-100;
                    opacity-0 skew-30 start-100 speed-100;
                    opacity-1 skew-0 start-100 speed-200;
                    scale-6 start-200 speed-200 opacity-0;
                    x-0 y-center scale-1 start-0 speed-0;
                    xy-bottomOut start-0 opacity-1;
                    y-370 start-500 speed-800 opacity-1 es-easeOutExpo;
                    "
                    class="text thin f120">TOUCH</h1>
            </div>
            <!-- Slide 3 - end -->
        </div>
    </div>
    </div>
    <!-- Slider layer - end
    ============================================================== -->
    <!-- Slider control - begin
    ============================================================== -->
    <div class="">
    <div class="container">
        <a id="tBox" class="btn small" href="#">Layout box | refresh slider</a>
        <a id="tLayout" class="btn small" href="#">Layut dot</a>
        <a id="tSlideshow" class="btn small" href="#">Slideshow</a>
        <a id="tTimer" class="btn small" href="#">Timer bar</a>
        <a id="tDrag" class="btn small" href="#">Drag off</a>
        <a id="tLoop" class="btn small" href="#">Loop slide</a>
        <div class="hr dash left ma-b-10"></div>
    </div>
    </div>
    <!-- Slider control - end
    ============================================================== -->
    <!-- Feature - begin
    ============================================================== -->
    <div class="wrapper">
    <div class="container">
    <div class="row">
        <!-- Feature item 1 - begin -->
        <div class="span4 feature-item">
            <div class="icon three">&nbsp;</div>
            <p style="font-weight: bold; font-size:17px">3 Layout slider</p>
            <!-- <h4>3 layout slider</h4> -->
            <p>Support multiply layout, style as much as possible.</p>
        </div>
        <!-- Feature item 1 - end -->
        <!-- Feature item 2 - begin -->
        <div class="span4 feature-item">
            <div class="icon res">&nbsp;</div>
            <h5>Responsive</h5>
            <p>Support fully responsive and non-responsive.</p>
        </div>
        <!-- Feature item 2 - end -->
        <!-- Feature item 3 - begin -->
        <div class="span4 feature-item">
            <div class="icon css3">&nbsp;</div>
            <h5>CSS3 transition</h5>
            <p>Priority use css3 transitions instead of jquery animate &rarr; reduced memory, faster performance.</p>
        </div>
        <!-- Feature item 3 - end -->
    </div>
    <div class="row">
        <!-- Feature item 4 - begin -->
        <div class="span4 feature-item">
            <div class="icon touch">&nbsp;</div>
            <h5>Touch friendly</h5>
            <p>Easy goto prev/next slide with intuitive touch/drag.</p>
        </div>
        <!-- Feature item 4 - end -->
        <!-- Feature item 5 - begin -->
        <div class="span4 feature-item">
            <div class="icon lazy">&nbsp;</div>
            <h5>Image lazyload</h5>
            <p>Show slider after loaded first slide, without waiting loaded all slide.</p>
        </div>
        <!-- Feature item 5 - end -->
        <!-- Feature item 6 - begin -->
        <div class="span4 feature-item">
            <div class="icon fitfill">&nbsp;</div>
            <h5>Image auto fit/fill</h5>
            <p>Image auto fit/fill slide. Support for images of different sizes.</p>
        </div>
        <!-- Feature item 6 - end -->
    </div>
    <div class="row">
        <!-- Feature item 7 - begin -->
        <div class="span4 feature-item">
            <div class="icon center">&nbsp;</div>
            <h5>Image center</h5>
            <p>If image size smaller/larger than slide, it's always in center of the slide.</p>
        </div>
        <!-- Feature item 7 - end -->
        <!-- Feature item 8 - begin -->
        <div class="span4 feature-item">
            <div class="icon mutual">&nbsp;</div>
            <h5>Layout mutual support</h5>
            <p>Switch layout, fallback layout custom when not brower not support css3 transition.</p>
        </div>
        <!-- Feature item 8 - end -->
        <!-- Feature item 9 - begin -->
        <div class="span4 feature-item">
            <div class="icon fullwidth">&nbsp;</div>
            <h5>Fullwidth helper</h5>
            <p>With mCanvas &amp; media, setup fullwidth becomes more easier.</p>
        </div>
        <!-- Feature item 9 - end -->
    </div>
    <div class="row">
        <!-- Feature item 10 - begin -->
        <div class="span4 feature-item">
            <div class="icon showhide">&nbsp;</div>
            <h5>Show/hide slider</h5>
            <p>Support show/hide slider depend on width page, or device.</p>
        </div>
        <!-- Feature item 10 - end -->
        <!-- Feature item 11 - begin -->
        <div class="span4 feature-item">
            <div class="icon layer">&nbsp;</div>
            <h5>Layer support</h5>
            <p>More vivid with layer, and css3 transform and easy setup.</p>
        </div>
        <!-- Feature item 11 - end -->
        <!-- Feature item 12 - begin -->
        <div class="span4 feature-item">
            <div class="icon multi">&nbsp;</div>
            <h5>Layer multi transition</h5>
            <p>Support multi transition with unlimited number.
            <br>Repeat and direction animation.</p>
        </div>
        <!-- Feature item 12 - end -->
    </div>
    <div class="row">
        <!-- Feature item 13 - begin -->
        <div class="span4 feature-item">
            <div class="icon autoplay">&nbsp;</div>
            <h5>Autoplay</h5>
            <p>Auto play when slide load complete. Auto pause when go out page, or scroll out sider</p>
        </div>
        <!-- Feature item 13 - end -->
        <!-- Feature item 14 - begin -->
        <div class="span4 feature-item">
            <div class="icon markup">&nbsp;</div>
            <h5>Markup flexible</h5>
            <p>Can use div or unordered list tag for slide. Position of elements  can be in/outside slider...</p>
        </div>
        <!-- Feature item 14 - end -->
        <!-- Feature item 15 - begin -->
        <div class="span4 feature-item">
            <div class="icon update">&nbsp;</div>
            <h5>Update options</h5>
            <p>Updated most of slider options.</p>
        </div>
        <!-- Feature item 15 - end -->
    </div>
        <!-- <div class="hr dash left no-ma"></div> -->
    </div>    
    </div>
    <!-- Feature - end
    ============================================================== -->
    <!-- Script - begin
    ============================================================== -->
    <script src="libs/scripts/jquery-1.10.2.min.js"></script> <!-- jQuery Libary -->
    <script src="libs/scripts/code09.js"></script> <!-- CODE09 custom -->
    <script src="code/codeslider.js"></script> <!-- Codeslider Plugins -->
    <script type="text/javascript">
        function toggle(cs, $el, propON, propOFF) {
            var _a = 'actived';
            if( $el.hasClass(_a) ) { $el.removeClass(_a); cs.prop(propOFF); }
            else                   { $el.addClass(_a); cs.prop(propON); }
        }
        function control() {
            var code = $('.cs').data('codeslider');
            // Toggle
            $('#tBox').on('click', function() {
                var _el = $(this), _a = 'actived', _l = 'layout-box';
                // var _on  = { isViewGrabStop : true }
                //   , _off = { isViewGrabStop : false };
                if( _el.hasClass(_a) ) {
                    _el.removeClass(_a);
                    $('body').removeClass(_l);
                    code.refresh();
                }
                else {
                    _el.addClass(_a);
                    $('body').addClass(_l);
                    code.refresh();
                }
                return false;
            });
            $('#tLayout').on('click', function() {
                var _on  = { fx : 'random' }
                  , _off = { fx : 'carousel' };
                toggle(code, $(this), _on, _off);
                return false;
            });
            $('#tSlideshow').on('click', function() {
                var _on  = { isSlideshow: true, timer: 'arc' }
                  , _off = { isSlideshow: false, timer: 'none' };
                toggle(code, $(this), _on, _off);
                return false;
            });
            $('#tTimer').on('click', function() {
                var _on  = { timer : 'bar' }
                  , _off = { timer : 'arc' };
                toggle(code, $(this), _on, _off);
                return false;
            });
            $('#tDrag').on('click', function() {
                var _el = $(this), _a = 'actived', _c = 'nav-hide';
                var _on  = { isDrag : false }
                  , _off = { isDrag : true };
                if( _el.hasClass(_a) ) {
                    _el.removeClass(_a);
                    code.prop(_off);
                    $('.cs').addClass(_c);      // After update properties
                }
                else {
                    _el.addClass(_a);
                    code.prop(_on);
                    $('.cs').removeClass(_c);   // After update properties
                }
                return false;
            });
            $('#tLoop').on('click', function() {
                var _on  = { isLoop : true }
                  , _off = { isLoop : false };
                toggle(code, $(this), _on, _off);
                return false;
            });
        }
        $(window).load(function() {
            // Slider init
            $('.cs').codeslider();
            // Control func
            control();
        });
    </script>
    <!-- Script - end
    ============================================================== -->



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滑动导航菜单 导航切换 html5动画导航菜单 带标题的焦点图 滑动选项卡切换 html5图片动画 带缩略图的幻灯片 带简介的焦点图 图片滑动 图片切换 html5文字动画 图片轮播 文字滑动 文字切换 自动滚动图片轮播 html5表情动画 滑动手风琴 背景切换 马赛克幻灯片 html5线条动画 滑动星星打分 手风琴 全屏焦点图 选项卡自动切换 html5飘落动画 视频切换 html5光标动画 列表切换 渐隐切换 html5悬停动画 全屏切换 切换按钮 缩放切换 滑动滑过 滚动切换 滑动选项卡切换 加载动画 flash焦点图 选项卡切换 滑动手风琴 html5弹窗动画 html5动画h5动画 焦点图幻灯片 html5按钮动画

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到