纯js超酷全屏带缩略图和图片倒影的轮播图插件

当前位置:主页 > jQuery库 > 幻灯片和轮播图 > 纯js超酷全屏带缩略图和图片倒影的轮播图插件
纯js超酷全屏带缩略图和图片倒影的轮播图插件
分享:

    插件介绍

    这是一款美轮美奂的纯js超酷全屏带缩略图和图片倒影的轮播图插件。该轮播图插件带有缩略图导航,并且每张图片都带有十分逼真的倒影效果。该轮播图代码在ie8下即可运行。

    浏览器兼容性

    浏览器兼容性
    时间:2014-12-03
    阅读:

简要教程

这是一款js大师级的作品。该插件使用纯javascript来实现图片的倒影效果和轮播图的缩略图及切换效果。

HTML

html代码十分简单:

<div id="imageFlow">
    <div class="top">
    </div>
    <div class="bank">
        <a rel="images/1.jpg" title="Myselves" href="http//www.zknyksd.com/">
        My identity lies in not knowing who I am</a>
        <a rel="images/2.jpg" title="Discoveries" href="http//www.zknyksd.com/">
        ...are made by not following instructions</a>
        <a rel="images/3.jpg" title="Nothing" href="http//www.zknyksd.com/">
        ...can come between us</a>
        <a rel="images/4.jpg" title="New life" href="http//www.zknyksd.com/">
        Here you come!</a>
        <a rel="images/5.jpg" title="Optimists" href="http://www.html.org.cn/">
        They don't know all the facts yet</a>
        <a rel="images/6.jpg" title="Empathy" href="http//www.zknyksd.com/">
        Emotional intimacy</a>
        <a rel="images/7.jpg" title="Much work" href="http//www.zknyksd.com/">
        ...remains to be done before we can announce our total failure to make any 
        progress</a>
        <a rel="images/8.jpg" title="System error" href="http//www.zknyksd.com/">
        Errare Programma Est</a>
        <a rel="images/9.jpg" title="Nonexistance" href="http//www.zknyksd.com/">
        There's no such thing</a>
        <a rel="images/10.jpg" title="Inside" href="http//www.zknyksd.com/">
        I抦 now trapped, without hope of escape or rescue</a>
        <a rel="images/11.jpg" title="E-Slaves" href="http//www.zknyksd.com/">
        The World is flat</a>
        <a rel="images/12.jpg" title="l0v3" href="http//www.zknyksd.com/">
        1 l0v3 j00 - f0r3v3r</a>
        <a rel="images/13.jpg" title="T minus zero" href="http//www.zknyksd.com/">
        111 111 111 x 111 111 111 = 12345678987654321</a>
        <a rel="images/14.jpg" title="The End" href="http//www.zknyksd.com/">
        ...has not been written yet</a> </div>
    <div class="text">
        <div class="title">
            Loading</div>
        <div class="legend">
            Please wait...</div>
    </div>
    <div class="scrollbar">
        <img class="track" src="images/track.jpg" alt="">
        <img class="arrow-left" src="images/sign_out.png" alt="">
        <img class="arrow-right" src="images/sign_in.png" alt="">
        <img class="bar" src="images/bar.jpg" alt=""> </div>
</div>
                

JAVASCRIPT

实现图片倒影的js函数如下:

function createReflexion (cont, img) {
    var flx = false;
    if (document.createElement("canvas").getContext) {
        flx = document.createElement("canvas");
        flx.width = img.width;
        flx.height = img.height;
        var context = flx.getContext("2d");
        context.translate(0, img.height);
        context.scale(1, -1);
        context.drawImage(img, 0, 0, img.width, img.height);
        context.globalCompositeOperation = "destination-out";
        var gradient = context.createLinearGradient(0, 0, 0, img.height * 2);
        gradient.addColorStop(1, "rgba(255, 255, 255, 0)");
        gradient.addColorStop(0, "rgba(255, 255, 255, 1)");
        context.fillStyle = gradient;
        context.fillRect(0, 0, img.width, img.height * 2);
    } else {
        /* ---- DXImageTransform ---- */
        flx     = document.createElement('img');
        flx.src = img.src;
        flx.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(' +
                           'opacity=50, style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=' +
                           (img.height * .25) + ')';
    }
    /* ---- insert Reflexion ---- */
    flx.style.position = 'absolute';
    flx.style.left     = '-1000px';
    cont.appendChild(flx);
    return flx;
}
                

其它部分的js代码和css代码请参考下载文件。

贵州快3

免责声明: 本站资料及图片来源互联网文章,本网不承担任何由内容信息所引起的争议和法律责任。所有作品版权归原创作者所有,与本站立场无关,如用户分享不慎侵犯了您的权益,请联系我们告知,我们将做删除处理!