zoukankan      html  css  js  c++  java
  • 一款基于jQuery的图片下滑切换焦点图插件

    之前为大家分享了好多款jquery插件,今天我们要分享的一款jQuery插件也比较实用,是一款jQuery焦点图插件。焦点图相当普通,一共可以循环播放4张图片,并且每一张图片在切换的时候都是向下滑动的切换效果,并且在向下切换时产生弹性的动画特效,另外,插件是基于jQuery的,各种浏览器的兼容性应该还不错。

    在线预览   源码下载

    下面是实现这款jQuery焦点图的过程和代码。

    HTML代码:

    <div class="slider-wrap col-width">
        <div class="cycleslider-wrap" style="display: block;">
           <div id="slider" class="cycleslider" style="position: relative;  970px; height: 350px;">
                 <div class="cycle-slider"><a href="http://js.itivy.com/"><img src="./images/1.jpg" width="970" height="350" alt="用最少的代码完成对多的事情"></a></div>
                 <div class="cycle-slider"><a href="http://js.itivy.com/"><img src="images/2.jpg" width="970" height="350" alt="为客户创造价值就是我们存在的价值"></a></div>
                  <div class="cycle-slider"><a href="http://js.itivy.com/"><img src="./images/1.jpg" width="970" height="350" alt="用最少的代码完成对多的事情"></a></div>
                 <div class="cycle-slider"><a href="http://js.itivy.com/"><img src="images/2.jpg" width="970" height="350" alt="为客户创造价值就是我们存在的价值"></a></div>
            </div>
            <a id="cycle-prev" href="#" style="opacity: 0; left: -50px;">Prev</a>
            <a id="cycle-next" href="#" style="opacity: 0; right: -50px;">Next</a>
            <div id="cycle-nav">
            </div>
        </div>
        <div class="loader" style="display: none;"></div>
    </div>

    HTML代码比较简单,其中有一个图片加载动画,初始化时在页面中隐藏,等待加载焦点图图片时将会出现Loading动画。

    jQuery代码:

    首先是引用了jQuery脚本库和slider的相应脚本库

    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.slider.pack.js"></script>
    <script type="text/javascript" src="js/jquery.easing.js"></script>

    然后就是渲染的初始化jQuery代码:

    jQuery(function() {
    jQuery('#cycle-prev, #cycle-next').css({opacity: '0'});
    jQuery('.cycleslider-wrap').hover(function(){
    jQuery('#cycle-prev',this).stop().animate({left: '-31', opacity: '1'},200,'easeOutCubic');
    jQuery('#cycle-next',this).stop().animate({right: '-31', opacity: '1'},200,'easeOutCubic');
    }, function() {
    jQuery('#cycle-prev',this).stop().animate({left: '-50', opacity: '0'},400,'easeInCubic');
    jQuery('#cycle-next',this).stop().animate({right: '-50', opacity: '0'},400,'easeInCubic');
    });
    
    jQuery(".cycleslider-wrap").fadeIn(1000);
    jQuery(".slider-wrap .loader").css({display: "none"});
    jQuery("#slider").cycle({
    fx:  "scrollDown",
    speed:  "800",
    timeout: "1000",
    easing:  "easeOutBounce",
    next:  "#cycle-next",
    prev:  "#cycle-prev",
    pager:  "#cycle-nav"
    });
    
    });

     via:http://www.w2bc.com/Article/12518

  • 相关阅读:
    HttpServletResponse对象
    FastJSON 简介及其Map/JSON/String 互转(转载)
    commons-lang3-3.4类库
    HttpClient相关
    JSON.parse()方法 (转载)
    textview用法--推荐
    每日总结
    百度网盘
    每日总结
    每日总结
  • 原文地址:https://www.cnblogs.com/liaohuolin/p/4160913.html
Copyright © 2011-2022 走看看