zoukankan      html  css  js  c++  java
  • 随机标签云

    html:
    <div class="hot-tag">
            <h2>热门标签</h2>
            <ul class="wrap-tag">
                <a href="#">傻白甜</a>
                <a href="#">小清新</a>
                <a href="#">文艺范</a>
                <a href="#">佛系</a>
                <a href="#">森女系</a>
                <a href="#">重金属</a>
                <a href="#">萌萌哒</a>
                <a href="#">摄影控</a>
                <a href="#">清风</a>
                <a href="#">萤火之森</a>
                <a href="#">治愈系</a>
                <a href="#">温情路线</a>
            </ul>
          </div>
    js:
    //随机方法
    function rand(num){
    return parseInt(Math.random()*num);
    }
    //随机颜色
    function randomcolor(){
    var colorAll=['f44336','ffab00','11c9c5','8fc31f','31afe9','b5a1eb','659fee','75ce49','ff5252','ff6d00','7c87c9']//随机颜色的取值范围
    var str=rand(11)
    return colorAll[str];
    }
    var obox=$(".wrap-tag");
    var obj=$(".wrap-tag a");
    for( len=obj.length,i=len;i--;){
    obj[i].className="color"+rand(5);
    obj[i].style.fontSize=rand(6)+12+"px";
    obj[i].style.color="#"+randomcolor();
    }
    --写于一个加班的周末
  • 相关阅读:
    Rotate List
    Spiral Matrix II
    Jump Game
    Maximum Subarray
    Pow(x, n)
    Anagrams
    Permutations
    unity 相机的问题
    NGUI 学习
    空间数据库1
  • 原文地址:https://www.cnblogs.com/wszxx/p/10292172.html
Copyright © 2011-2022 走看看