美文网首页
文字云标签冒泡

文字云标签冒泡

作者: g0 | 来源:发表于2018-08-07 14:16 被阅读20次
    
    
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>云签</title>
    <style>
    * {
        margin: 0px;
        margin: 0px;
    }
    body {
        background: #dddddd;
    }
    h1 {
        text-align: center;
        color: #7b7b7b;
        font-size: 30px;
        position: absolute;
        top: 100px;
        left: 50%;
        width: 300px;
        margin-left: -150px;
    }
    #div1 {
        position: relative;
        width: 990px;
        height: 260px;
        margin: 146px auto 0;
        overflow: hidden;
        box-shadow: 0 0 50px #8e8e8e;
        -webkit-box-shadow: 0 0 50px #8e8e8e;
        -moz-box-shadow: 0 0 50px #8e8e8e;
    }
    #div1 a {
        position: absolute;
        color: #8e8e8e;
        text-decoration: none;
        top: 260px;
        display: block;
        border: #8e8e8e 1px solid;
        box-shadow: 0 0 5px #8e8e8e;
        -webkit-box-shadow: 0 0 5px #8e8e8e;
        -moz-box-shadow: 0 0 5px #8e8e8e;
        background: #fff;
     filter: alpha(opacity: 30);
        opacity: 0.3;
        font-size: 14px;
        padding: 3px 5px;
        font-family: arial;
    }
    #div1 a:hover {
     filter: alpha(opacity: 100);
        opacity: 1;
        font-weight: bold;
        font-size: 16px;
    }
    </style>
    
    <script>
        window.onload = function() {
        var oDiv = document.getElementById('div1');
        var aA = document.getElementsByTagName('a');
        var i = 0;
        for (i = 0; i < aA.length; i++) {
            aA[i].pause = 1;
            aA[i].time = null;
            initialize(aA[i]);
            aA[i].onmouseover = function() {
                this.pause = 0;
            };
            aA[i].onmouseout = function() {
                this.pause = 1;
            };
        }
        setInterval(starmove, 50);
    
        function starmove() {
            for (i = 0; i < aA.length; i++) {
                if (aA[i].pause) {
                    domove(aA[i]);
                }
            }
        }
    
        function domove(obj) {
            if (obj.offsetTop <= -obj.offsetHeight) {
                obj.style.top = oDiv.offsetHeight + "px";
                initialize(obj);
            } else {
                obj.style.top = obj.offsetTop - obj.ispeed + "px";
            }
        }
    
        function initialize(obj) {
            var iLeft = parseInt(Math.random() * oDiv.offsetWidth);
            var scale = Math.random() * 1 + 1;
            var iTimer = parseInt(Math.random() * 1500);
            obj.pause = 0;
    
            obj.style.fontSize = 12 * scale + 'px';
    
            if ((iLeft - obj.offsetWidth) > 0) {
                obj.style.left = iLeft - obj.offsetWidth + "px";
            } else {
                obj.style.left = iLeft + "px";
            }
            clearTimeout(obj.time);
            obj.time = setTimeout(function() {
                obj.pause = 1;
            }, iTimer);
            obj.ispeed = Math.ceil(Math.random() * 4) + 1;
        }
    };
    </script>
    </head>
    
    <body>
    
    <h1>云签</h1>
    <div id="div1">
        <a href="#" >知识决定一切</a>
        <a href="#" >好好学习</a>
        <a href="#" >寻龙诀</a>
        <a href="#" >JavaScript</a>
        <a href="#" >LEO</a>
        <a href="#" >加油</a>
        <a href="#" >web前端</a>
        <a href="#" >web前端工程师</a>
        <a href="#" >css3</a>
        <a href="#" >曹操</a>
        <a href="#" >警觉女王</a>
        <a href="#" >磁场</a>
        <a href="#" >好好</a>
        <a href="#" >我都怕的</a>
        <a href="#" >html5</a>
        <a href="#" >web前端开发</a>
        <a href="#" >jQuery</a>
        <a href="#" >知识决定一切</a>
        <a href="#" >好好学习</a>
        <a href="#" >寻龙诀</a>
        <a href="#" >JavaScript</a>
        <a href="#" >LEO</a>
        <a href="#" >加油</a>
        <a href="#" >web前端</a>
        <a href="#" >web前端工程师</a>
        <a href="#" >css3</a>
        <a href="#" >曹操</a>
        <a href="#" >警觉女王</a>
        <a href="#" >磁场</a>
        <a href="#" >好好</a>
        <a href="#" >我都怕的</a>
        <a href="#" >html5</a>
        <a href="#" >web前端开发</a>
        <a href="#" >jQuery</a>
    </div>
    
    </body>
    </html>
    
    
    

    相关文章

      网友评论

          本文标题:文字云标签冒泡

          本文链接:https://www.haomeiwen.com/subject/vuzovftx.html