zoukankan      html  css  js  c++  java
  • 鼠标经过文字时改变该文字及其周边文字的位置

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <style>
            *{margin:0;padding:0;}
            .con{margin:20px auto;text-align:center;}
            .con p{display:inline-block;position:relative;cursor:pointer;width:20px;height:20px;}
        </style>
    </head>
    <body>
    <div class="con">
        <p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </div>
    <div class="con">
        <p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </div>
    <div class="con">
        <p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </div>
    <div class="con">
        <p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </div>
    <div class="con">
        <p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
    </div>
    </body>
    <script src="jquery-1.11.3.min.js"></script>
    <script>
        var timer;
        $(".con").find("p").hover(function(){
            clear();
            var $this=$(this);
            timer=window.setTimeout(function(){
                $this.animate({"top":"-10px"});
                $this.prev().animate({"top":"-6px"});
                $this.next().animate({"top":"-6px"});
                $this.prev().prev().animate({"top":"-2px"});
                $this.next().next().animate({"top":"-2px"});
            },100);
    
        },function(){
            clear();
            $(".con").find("p").animate({top:0});
        });
        function clear(){
            clearTimeout(timer);
            timer=null;
        }
    </script>
    </html>
  • 相关阅读:
    [BZOJ3513] idiots
    2020牛客暑期多校训练营(第六场)A
    2020牛客暑期多校训练营(第六场)J
    2020牛客暑期多校训练营(第六场)H
    2020牛客暑期多校训练营(第六场)G
    2020牛客暑期多校训练营(第六场)K
    组队训练日志 2020.10.05
    Java基础
    Auditd
    Snort记录
  • 原文地址:https://www.cnblogs.com/dongxiaolei/p/5817632.html
Copyright © 2011-2022 走看看