码迷,mamicode.com
首页 > 其他好文 > 详细

扫什么,评什么

时间:2020-01-15 13:40:52      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:失败   存储   min   oar   one   段落   pos   基础   radius   

今天打开朋友圈,许多朋友都在发“扫什么评什么”,虽然这个只是一个朋友圈游戏,但是作为一个程序员,总是想去研究一下他到底是怎么实现的,打开源代码一看便知道怎么来实现这么一个“游戏”。

技术图片

接下来,简单的分析一下,有过网站基础的朋友一看就知道怎么来实现的,并没有什么技术含量。

界面代码

我们先不管复制怎么显示,只要“变化”的文字实现原理

技术图片

引用文字

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>你也来试试!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0 user-scalable=no">

<script src="http://css.0826.cc/w/clipboard.min.js"></script>

<script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://css.0826.cc/w/style.css" media="screen">
<style>
body{
    background: #eaeaea;
}
main{
    width: 100%;
    height: 30rem;
}
.contents{
    padding: 15rem 0;
}
#content-desc{
    width: 85%;
    margin: -102px auto;
    font-family: KaiTi;
    //font-size: 19px;
}
footer{
    width: 100%;
}
ul{
    width: 70%;
    margin: -80px 5%;
}
li{
    list-style: none;
    width: 90%;
    height: 2rem;
    text-align: center;
    margin-top: 10px;
    border: 1.9px solid black;
    border-radius:8px;
    margin: 10px auto;
    line-height: 2rem;
    font-size: 1rem;
    font-family: KaiTi;
    cursor: pointer;
    font-weight: bold;

}

    #content-desc span{  
        float:left;  
        position: relative;  
    }  

    #content-desc span:nth-child(1){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(2){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(3){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(4){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(5){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(6){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(7){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(8){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(9){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(10){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(11){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(12){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(13){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(14){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(15){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(16){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(17){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(18){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(19){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(20){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(21){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(22){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(23){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(24){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(25){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(26){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(27){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(28){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(29){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(30){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(31){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(32){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(33){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    
     #content-desc span:nth-child(34){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(35){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(36){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(37){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(38){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(39){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
 


    @-webkit-keyframes jump  
    {  
        0%{  
            top:0px;  
            color:#fbb2b2;  
        }  
        50%{  
            top:-3px;  
            color:#0e8761;  
        }  
        100%{  
            top:2px;  
            color:#327fc2;  
        }  
    }  

    </style>

<meta name="GENERATOR" content="MSHTML 9.00.8112.16723"></head>
<body>
<main>
    <article class="contents">
        <div id="content-desc"><span class="span1">来</span><span class="span2">,</span><span class="span3">有</span><span class="span4">事</span><span class="span5">床</span><span class="span6">上</span><span class="span7">聊</span><span class="span8">。</span></div>
    </article>
</main>
<footer>
<nav>
<ul>
  <li class="btn">                点击复制这句话            </li>
  <li class="jump">                            我也要玩                        </li>
</ul>
</nav>
<input class="weburl" value="https://mp.weixin.qq.com/s/h7SGqC8yJ2d0iq1yq4mEgw" type="hidden">
</footer>
<script type="text/javascript">

var rand1 = parseInt(Math.random()*40);
quotes = new Array;
quotes[0] = ‘<span class="span1">你</span><span class="span2">会</span><span class="span3">不</span><span class="span4">会</span><span class="span5">突</span><span class="span6">然</span><span class="span7">地</span><span class="span8">出</span><span class="span9">现</span><span class="span10">,</span><span class="span11">在</span><span class="span12">街</span><span class="span13">角</span><span class="span14">的</span><span class="span15">大</span><span class="span16">保</span><span class="span17">健</span><span class="span18">。</span>‘;

quotes[1] = ‘<span class="span1">如</span><span class="span2">何</span><span class="span3">证</span><span class="span4">明</span><span class="span5">你</span><span class="span6">的</span><span class="span7">实</span><span class="span8">力</span><span class="span9">?</span><br><span class="span10">住</span><span class="span11">酒</span><span class="span12">店</span><span class="span13">一</span><span class="span14">定</span><span class="span15">要</span><span class="span16">选</span><span class="span17">隔</span><span class="span18">音</span><span class="span19">最</span><span class="span20">好</span><span class="span21">的</span><span class="span22">。</span>‘;

quotes[2] = ‘<span class="span1">你</span><span class="span2">的</span><span class="span3">名</span><span class="span4">字</span><span class="span5">是</span><span class="span6">最</span><span class="span7">短</span><span class="span8">的</span><span class="span9">情</span><span class="span10">诗</span><span class="span11">。</span>‘;

quotes[3] = ‘<span class="span1">为</span><span class="span2">了</span><span class="span3">节</span><span class="span4">约</span><span class="span5">用</span><span class="span6">水</span><span class="span7">,</span><span class="span8">今</span><span class="span9">晚</span><span class="span10">可</span><span class="span11">以</span><span class="span12">一</span><span class="span13">起</span><span class="span14">洗</span><span class="span15">澡</span><span class="span16">吗</span><span class="span17">?</span>‘;

quotes[4] = ‘<span class="span1">像</span><span class="span2">你</span><span class="span3">这</span><span class="span4">种</span><span class="span5">平</span><span class="span6">胸</span><span class="span7">的</span><span class="span8">,</span><span class="span9">只</span><span class="span10">能</span><span class="span11">好</span><span class="span12">好</span><span class="span13">学</span><span class="span14">习</span>‘;

quotes[5] = ‘<span class="span1">现</span><span class="span2">在</span><span class="span3">的</span><span class="span4">男</span><span class="span5">朋</span><span class="span6">友</span><span class="span7">应</span><span class="span8">该</span><span class="span9">像</span><span class="span10">蚊</span><span class="span11">子</span><span class="span12">一</span><span class="span13">样</span><span class="span14">,</span><span class="span15">一</span><span class="span16">不</span><span class="span17">留</span><span class="span18">神</span><span class="span19">就</span><span class="span20">让</span><span class="span21">你</span><span class="span22">手</span><span class="span23">上</span><span class="span24">多</span><span class="span25">个</span><span class="span26">包</span><span class="span27">。</span>‘;

quotes[6] = ‘<span class="span1">“宝</span><span class="span2">贝</span><span class="span3">,</span><span class="span4">我</span><span class="span5">想</span><span class="span6">给</span><span class="span7">你</span><span class="span8">整</span><span class="span9">个</span><span class="span10">世</span><span class="span11">界</span><span class="span12">。”</span><br><span class="span13">“那</span><span class="span14">你</span><span class="span15">整</span><span class="span16">吧</span><span class="span17">!”</span>‘;

quotes[7] = ‘<span class="span1">你</span><span class="span2">所</span><span class="span3">有</span><span class="span4">为</span><span class="span5">人</span><span class="span6">称</span><span class="span7">道</span><span class="span8">的</span><span class="span9">美</span><span class="span10">丽</span><span class="span11">,</span><span class="span12">都</span><span class="span13">有</span><span class="span14">美</span><span class="span15">图</span><span class="span16">秀</span><span class="span17">秀</span><span class="span18">的</span><span class="span19">痕</span><span class="span20">迹</span><span class="span21">。</span>‘;

quotes[8] = ‘<span class="span1">别</span><span class="span2">人</span><span class="span3">笑</span><span class="span4">起</span><span class="span5">来</span><span class="span6">的</span><span class="span7">样</span><span class="span8">子</span><span class="span9">很</span><span class="span10">好</span><span class="span11">看</span><span class="span12">,</span><span class="span13">你</span><span class="span14">笑</span><span class="span15">起</span><span class="span16">来</span><span class="span17">的</span><span class="span18">样</span><span class="span19">子</span><span class="span20">很</span><span class="span21">好</span><span class="span22">笑</span><span class="span23">。</span>‘;

quotes[9] = ‘<span class="span1">如</span><span class="span2">果</span><span class="span3">你</span><span class="span4">前</span><span class="span5">女</span><span class="span6">友</span><span class="span7">和</span><span class="span8">现</span><span class="span9">女</span><span class="span10">友</span><span class="span11">同</span><span class="span12">时</span><span class="span13">掉</span><span class="span14">到</span><span class="span15">河</span><span class="span16">里</span><span class="span17">了</span><span class="span18">,</span><span class="span19">那</span><span class="span20">么</span><span class="span21">,</span><span class="span22">请</span><span class="span23">问</span><span class="span24">我</span><span class="span25">可</span><span class="span26">以</span><span class="span27">做</span><span class="span28">你</span><span class="span29">女</span><span class="span30">朋</span><span class="span31">友</span><span class="span32">么</span><span class="span33">?</span>‘;

quotes[10] = ‘<span class="span1">睡</span><span class="span2">不</span><span class="span3">到</span><span class="span4">我</span><span class="span5">,</span><span class="span6">你</span><span class="span7">的</span><span class="span8">人</span><span class="span9">生</span><span class="span10">还</span><span class="span11">有</span><span class="span12">什</span><span class="span13">么</span><span class="span14">意</span><span class="span15">义</span><span class="span16">。</span>‘;

quotes[11] = ‘<span class="span1">你</span><span class="span2">复</span><span class="span3">杂</span><span class="span4">的</span><span class="span5">五</span><span class="span6">官</span><br><span class="span7">掩</span><span class="span8">饰</span><span class="span9">不</span><span class="span10">了</span><span class="span11">你</span><span class="span12">朴</span><span class="span13">素</span><span class="span14">的</span><span class="span15">智</span><span class="span16">商</span><span class="span17">。</span>‘;

quotes[12] = ‘<span class="span1">你</span><span class="span2">认</span><span class="span3">真</span><span class="span4">的</span><span class="span5">样</span><span class="span6">子</span><span class="span7">就</span><span class="span8">像</span><span class="span9">天</span><span class="span10">桥</span><span class="span11">上</span><span class="span12">贴</span><span class="span13">膜</span><span class="span14">的</span><span class="span15">。</span>‘;

quotes[13] = ‘<span class="span1">从</span><span class="span2">此</span><span class="span3">我</span><span class="span4">爱</span><span class="span5">的</span><span class="span6">人</span><span class="span7">都</span><span class="span8">不</span><span class="span9">像</span><span class="span10">你</span><span class="span11">。</span>‘;

quotes[14] = ‘<span class="span1">我</span><span class="span2">喜</span><span class="span3">欢</span><span class="span4">你</span><span class="span5">,</span><span class="span6">就</span><span class="span7">像</span><span class="span8">你</span><span class="span9">妈</span><span class="span10">打</span><span class="span11">你</span><span class="span12">不</span><span class="span13">讲</span><span class="span14">道</span><span class="span15">理</span><span class="span16">。</span>‘;

quotes[15] = ‘<span class="span1">青</span><span class="span2">春</span><span class="span3">荒</span><span class="span4">唐</span><span class="span5">不</span><span class="span6">负</span><span class="span7">你</span><span class="span8">,</span><br><span class="span9">全</span><span class="span10">套</span><span class="span11">包</span><span class="span12">夜</span><span class="span13">八</span><span class="span14">百</span><span class="span15">起</span><span class="span16">。</span>‘;

quotes[16] = ‘<span class="span1">希</span><span class="span2">望</span><span class="span3">一</span><span class="span4">切</span><span class="span5">事</span><span class="span6">情</span><span class="span7">都</span><span class="span8">像</span><span class="span9">长</span><span class="span10">胖</span><span class="span11">那</span><span class="span12">么</span><span class="span13">容</span><span class="span14">易</span>‘;

quotes[17] = ‘<span class="span1">我</span><span class="span2">养</span><span class="span3">你</span><span class="span4">啊</span><span class="span5">。</span>‘;

quotes[18] = ‘<span class="span1">我</span><span class="span2">来</span><span class="span3">到</span><span class="span4">你</span><span class="span5">的</span><span class="span6">城</span><span class="span7">市</span><span class="span8">,</span><br><span class="span9">你</span><span class="span10">却</span><span class="span11">不</span><span class="span12">管</span><span class="span13">顿</span><span class="span14">饭</span><span class="span15">吃</span><span class="span16">。</span>‘;

quotes[19] = ‘<span class="span1">你</span><span class="span2">走</span><span class="span3">了</span><span class="span4">真</span><span class="span5">好</span><span class="span6">,</span><br><span class="span7">不</span><span class="span8">然</span><span class="span9">总</span><span class="span10">担</span><span class="span11">心</span><span class="span12">你</span><span class="span13">要</span><span class="span14">留</span><span class="span15">下</span><span class="span16">来</span><span class="span17">吃</span><span class="span18">饭</span><span class="span19">。</span>‘;

quotes[20] = ‘<span class="span1">以</span><span class="span2">后</span><span class="span3">的</span><span class="span4">路</span><span class="span5">你</span><span class="span6">自</span><span class="span7">己</span><span class="span8">走</span><span class="span9">,</span><span class="span10">我</span><span class="span11">打</span><span class="span12">车</span><span class="span13">。</span>‘;

quotes[21] = ‘<span class="span1">手</span><span class="span2">不</span><span class="span3">要</span><span class="span4">给</span><span class="span5">别</span><span class="span6">人</span><span class="span7">牵</span><span class="span8">,</span><br><span class="span9">拥</span><span class="span10">抱</span><span class="span11">也</span><span class="span12">要</span><span class="span13">留</span><span class="span14">给</span><span class="span15">我</span><span class="span16">。</span>‘;

quotes[22] = ‘<span class="span1">爱</span><span class="span2">你</span><span class="span3">就</span><span class="span4">像</span><span class="span5">拉</span><span class="span6">肚</span><span class="span7">子</span><span class="span8">一</span><span class="span9">样</span><span class="span10">无</span><span class="span11">法</span><span class="span12">控</span><span class="span13">制</span><span class="span14">。</span>‘;

quotes[23] = ‘<span class="span1">如</span><span class="span2">果</span><span class="span3">再</span><span class="span4">见</span><span class="span5">不</span><span class="span6">能</span><span class="span7">红</span><span class="span8">着</span><span class="span9">脸</span><span class="span10">,</span><br><span class="span11">是</span><span class="span12">否</span><span class="span13">还</span><span class="span14">能</span><span class="span15">借</span><span class="span16">点</span><span class="span17">钱</span><span class="span18">。</span>‘;

quotes[24] = ‘<span class="span1">虽</span><span class="span2">然</span><span class="span3">你</span><span class="span4">长</span><span class="span5">的</span><span class="span6">丑</span><span class="span7">,</span><span class="span8">但</span><span class="span9">你</span><span class="span10">想</span><span class="span11">的</span><span class="span12">美</span><span class="span13">啊</span><span class="span14">!</span>‘;

quotes[25] = ‘<span class="span1">有</span><span class="span2">空</span><span class="span3">一</span><span class="span4">起</span><span class="span5">睡</span><span class="span6">觉</span><span class="span7">啊</span><span class="span8">?</span>‘;

quotes[26] = ‘<span class="span1">来</span><span class="span2">,</span><span class="span3">有</span><span class="span4">事</span><span class="span5">床</span><span class="span6">上</span><span class="span7">聊</span><span class="span8">。</span>‘;

quotes[27] = ‘<span class="span1">在</span><span class="span2">有</span><span class="span3">生</span><span class="span4">之</span><span class="span5">年</span><span class="span6">遇</span><span class="span7">见</span><span class="span8">你</span><span class="span9">,</span><br><span class="span10">竟</span><span class="span11">花</span><span class="span12">光</span><span class="span13">了</span><span class="span14">我</span><span class="span15">所</span><span class="span16">有</span><span class="span17">的</span><span class="span18">积</span><span class="span19">蓄</span><span class="span20">。</span>‘;

quotes[28] = ‘<span class="span1">多</span><span class="span2">照</span><span class="span3">照</span><span class="span4">镜</span><span class="span5">子</span><span class="span6">,</span><br><span class="span7">很</span><span class="span8">多</span><span class="span9">事</span><span class="span10">情</span><span class="span11">你</span><span class="span12">就</span><span class="span13">明</span><span class="span14">白</span><span class="span15">原</span><span class="span16">因</span><span class="span17">了</span><span class="span18">。</span>‘;

quotes[29] = ‘<span class="span1">我</span><span class="span2">喜</span><span class="span3">欢</span><span class="span4">你</span><span class="span5">,</span><span class="span6">从</span><span class="span7">一</span><span class="span8">而</span><span class="span9">终</span><span class="span10">,</span><span class="span11">认</span><span class="span12">真</span><span class="span13">且</span><span class="span14">怂</span><span class="span15">。</span>‘;

quotes[30] = ‘<span class="span1">别</span><span class="span2">再</span><span class="span3">说</span><span class="span4">自</span><span class="span5">己</span><span class="span6">是</span><span class="span7">单</span><span class="span8">身</span><span class="span9">狗</span><span class="span10">了</span><span class="span11">,</span><span class="span12">你</span><span class="span13">这</span><span class="span14">个</span><span class="span15">年</span><span class="span16">纪</span><span class="span17">狗</span><span class="span18">都</span><span class="span19">死</span><span class="span20">了</span><span class="span21">。</span>‘;

quotes[31] = ‘<span class="span1">“</span><span class="span2">用</span><span class="span3">两</span><span class="span4">个</span><span class="span5">字</span><span class="span6">形</span><span class="span7">容</span><span class="span8">你</span><span class="span9">的</span><span class="span10">罩</span><span class="span11">杯</span><span class="span12">”</span><span class="span13">“</span><span class="span14">随</span><span class="span15">爹</span><span class="span16">”</span>‘;

quotes[32] = ‘<span class="span1">气</span><span class="span2">质</span><span class="span3">永</span><span class="span4">远</span><span class="span5">都</span><span class="span6">是</span><span class="span7">无</span><span class="span8">法</span><span class="span9">估</span><span class="span10">价</span><span class="span11">的</span><span class="span12">,</span><span class="span13">不</span><span class="span14">然</span><span class="span15">我</span><span class="span16">早</span><span class="span17">就</span><span class="span18">身</span><span class="span19">价</span><span class="span20">百</span><span class="span21">万</span><span class="span22">了</span><span class="span23">。</span>‘;

quotes[33] = ‘<span class="span1">你</span><span class="span2">这</span><span class="span3">人</span><span class="span4">没</span><span class="span5">啥</span><span class="span6">特</span><span class="span7">出</span><span class="span8">众</span><span class="span9">,</span><span class="span10">就</span><span class="span11">是</span><span class="span12">脸</span><span class="span13">皮</span><span class="span14">够</span><span class="span15">坚</span><span class="span16">固</span><span class="span17">。</span>‘;

quotes[34] = ‘<span class="span1">我</span><span class="span2">要</span><span class="span3">吃</span><span class="span4">胖</span><span class="span5">点</span><span class="span6">,</span><span class="span7">这</span><span class="span8">个</span><span class="span9">冬</span><span class="span10">天</span><span class="span11">才</span><span class="span12">不</span><span class="span13">会</span><span class="span14">感</span><span class="span15">觉</span><span class="span16">冷</span><span class="span17">。</span>‘;

quotes[35] = ‘<span class="span1">一</span><span class="span2">直</span><span class="span3">非</span><span class="span4">常</span><span class="span5">羡</span><span class="span6">慕</span><span class="span7">我</span><span class="span8">的</span><span class="span9">男</span><span class="span10">朋</span><span class="span11">友</span><span class="span12">,</span><span class="span13">他</span><span class="span14">有</span><span class="span15">一</span><span class="span16">个</span><span class="span17">世</span><span class="span18">界</span><span class="span19">上</span><span class="span20">最</span><span class="span21">好</span><span class="span22">的</span><span class="span23">女</span><span class="span24">朋</span><span class="span25">友</span><span class="span26">。</span>‘;

quotes[36] = ‘<span class="span1">如</span><span class="span2">果</span><span class="span3">白</span><span class="span4">痴</span><span class="span5">会</span><span class="span6">飞</span><span class="span7">,</span><span class="span8">那</span><span class="span9">我</span><span class="span10">身</span><span class="span11">边</span><span class="span12">简</span><span class="span13">直</span><span class="span14">是</span><span class="span15">个</span><span class="span16">飞</span><span class="span17">机</span><span class="span18">场</span><span class="span19">。</span>‘;

quotes[37] = ‘<span class="span1">别</span><span class="span2">人</span><span class="span3">笑</span><span class="span4">起</span><span class="span5">来</span><span class="span6">很</span><span class="span7">好</span><span class="span8">看</span><span class="span9">,</span><span class="span10">但</span><span class="span11">你</span><span class="span12">不</span><span class="span13">一</span><span class="span14">样</span><span class="span15">,</span><span class="span16">你</span><span class="span17">是</span><span class="span18">看</span><span class="span19">起</span><span class="span20">来</span><span class="span21">很</span><span class="span22">好</span><span class="span23">笑</span><span class="span24">。</span>‘;

quotes[38] = ‘<span class="span1">只</span><span class="span2">是</span><span class="span3">因</span><span class="span4">为</span><span class="span5">在</span><span class="span6">人</span><span class="span7">群</span><span class="span8">中</span><span class="span9">多</span><span class="span10">看</span><span class="span11">了</span><span class="span12">你</span><span class="span13">一</span><span class="span14">眼</span><span class="span15">,</span><span class="span16">就</span><span class="span17">不</span><span class="span18">想</span><span class="span19">再</span><span class="span20">看</span><span class="span21">第</span><span class="span22">二</span><span class="span23">眼</span><span class="span24">。</span>‘;

quotes[39] = ‘<span class="span1">我</span><span class="span2">们</span><span class="span3">不</span><span class="span4">要</span><span class="span5">再</span><span class="span6">见</span><span class="span7">面</span><span class="span8">了</span><span class="span9">,</span><span class="span10">洗</span><span class="span11">头</span><span class="span12">好</span><span class="span13">累</span><span class="span14">,</span><span class="span15">洗</span><span class="span16">发</span><span class="span17">水</span><span class="span18">好</span><span class="span19">贵</span><span class="span20">。</span>‘;

var quote = quotes[rand1];
$("#content-desc").html(quote);


</script>
<script>
    var clipboard = new Clipboard(‘.btn‘, {
        text: function() {
            return $("#content-desc").text();
        }
    });

    clipboard.on(‘success‘, function(e) {
        alert("复制成功");
    });

    clipboard.on(‘error‘, function(e) {
        alert("复制失败");
    });
    $(".jump").click(function(){
        window.location.href=$(".weburl").val();
    })
    </script>


</body></html>

实现原理:创建下标为0-39的数组用来存储不同html段落,然后运用var rand1 = parseInt(Math.random()*40);随机数来得到0-40的下标,最后获取指定数组的值,将html段落添加到指定位置var quote = quotes[rand1];$("#content-desc").html(quote); Game Over..

复制功能,运用了<script src="http://css.0826.cc/w/clipboard.min.js"></script>插件,这个是将文本复制到剪贴板的插件

扫什么,评什么

标签:失败   存储   min   oar   one   段落   pos   基础   radius   

原文地址:https://www.cnblogs.com/jlfw/p/12195966.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!