zoukankan      html  css  js  c++  java
  • jquery 幻灯片

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>lin_jquery</title>
    <style type="text/css">
    .linContainer{margin:10px auto;790px;}
    .linBox{790px;overflow:hidden;height:300px;position:relative;z-index:1;}
    .linBoxImg{position:absolute;z-index:10;}
    img{border:none;}
    .linBoxImg img{float:left;}
    .clearBoth{clear:both;}
    .linNum{position:absolute; top:230px;right:40px;z-index:100;}
    .linNum a{color:#000000;padding:5px;text-decoration:none;}
    .linActive{font-weight:bold;}
    .linNum a.linActive{color:#ffff00;text-decoration:underline;}
    </style>
    <script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
    </head>
    <body>
    <div class="linContainer">
        <div class="linBox">
            <div class="linBoxImg">
                <a href="x"><img src="./images/reel_1.jpg" /></a>
                <a href="2"><img src="./images/reel_2.jpg" /></a>
                <a href="3"><img src="./images/reel_3.jpg" /></a>
                <a href="4"><img src="./images/reel_4.jpg" /></a>
                <br class="clearBoth" />
            </div>
            <div class="linNum">
            <a href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a>
            </div>
        </div>
    </div>
    </body>
    <script type="text/javascript">
    $(document).ready(function(){
        var imgWidth = $(".linBox img").width();
        var imgNum = $(".linBox img").size();
        var imgTotal = imgWidth * imgNum;
        var leftWidth = 0;
        var nnn = 0;
        var leftTotal = -imgWidth * (imgNum - 1);
        $(".linNum a").eq(0).addClass("linActive");
        $(".linBoxImg").css({"width": imgTotal});

        play = function(){
            ok = setInterval(function(){
                $(".linBoxImg").animate({left:leftWidth});
                leftWidth -= imgWidth;
                $(".linNum a").removeClass("linActive");
                $(".linNum a").eq(nnn).addClass("linActive");
                    nnn++;
                if(leftWidth < leftTotal){
                    leftWidth = 0;
                    nnn = 0;
                }
            }, 2000);
        };

        play();
        $(".linNum a").hover(function(){
            $(".linNum a").removeClass("linActive");
            $(this).addClass("linActive");
            var nn = $(this).index();
            leftWidth = -nn * imgWidth;
            $(".linBoxImg").animate({left:leftWidth});
            clearInterval(ok);
        }, function(){
            $(this).removeClass("linActive");
            play();
        });
        $(".linNum a").click(function(){ // 清除点击
            return false;
        });
    });
    </script>
    </body>
    </html>

  • 相关阅读:
    字符串匹配的KMP算法
    附加数据库出错
    SQL Server 2005
    OpenFileDialog对话框Filter属性
    flink run 报错java.lang.NoSuchMethodError: org.apache.hadoop.ipc.Client.getRpcTimeout(Lorg/apache/hadoop/conf/Configuration;)I
    修改cdh5集群中主机节点IP或hostName
    oracle 自增序列 在 mybatis中应用
    org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
    java远程连接hadoop,kerbers认证失败 报no supported default etypes for default_tkt_enctypes
    hive distribute by sort by 去重
  • 原文地址:https://www.cnblogs.com/lin3615/p/3590781.html
Copyright © 2011-2022 走看看