JavaScript制作颜色反转小游戏

前端之家收集整理的这篇文章主要介绍了JavaScript制作颜色反转小游戏前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

游戏规则:

单击方块,被单击的方块及相邻方块变色,当所有蓝色方块变为橙色时,完成任务,进入下一级。

<Meta charset="utf-8">

<Meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

颜色翻转 <Meta name="description" content=""> <Meta name="author" content="jiamengkai">

<Meta name="viewport" content="width=device-width; initial-scale=1.0">

<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

<style type="text/css">

  • {
    margin: 0;
    padding: 0;
    font-family: "Microsoft yahei";
    color: #000;
    }
    h1 {
    margin: 10px 0;
    font-size: 300%;
    font-weight: bolder;
    }
    span {
    display: block;
    text-indent: 32px;
    }
    .title {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 600px;
    margin: -300px 0 0 -500px;
    }
    .main {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    margin: -300px 0 0 -150px;
    background: #555;
    border-radius: 8px;
    1border: 5px solid #555;
    }
    .blue,.orange {
    margin: 5px;
    }
    .blue {
    background: #099;
    border-radius: 8px;
    float: left;
    }
    .orange {
    background: #D69C49;
    border-radius: 8px;
    float: left;
    }
    .button {
    1display: inline-block;
    zoom: 1; / zoom and display = ie7 hack for display:inline-block */
    display: block;
    vertical-align: baseline;
    margin: 8px 5px;
    outline: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font: 14px/100% Arial,Helvetica,sans-serif;
    padding: .5em 2em .55em;
    text-shadow: 0 1px 1px rgba(0,.3);
    -webkit-border-radius: .5em;
    -moz-border-radius: .5em;
    border-radius: .5em;
    -webkit-Box-shadow: 0 1px 2px rgba(0,.2);
    -moz-Box-shadow: 0 1px 2px rgba(0,.2);
    Box-shadow: 0 1px 2px rgba(0,.2);
    }
    .button:hover {
    text-decoration: none;
    }
    .button:active {
    position: relative;
    top: 1px;
    }
    .btn {
    color: #fef4e9;
    border: solid 1px #da7c0c;
    background: #f78d1d;
    background: -webkit-gradient(linear,left top,left bottom,from(#faa51a),to(#f47a20));
    background: -moz-linear-gradient(top,#faa51a,#f47a20);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a',endColorstr='#f47a20');
    }
    .btn:hover {
    background: #f47c20;
    background: -webkit-gradient(linear,from(#f88e11),to(#f06015));
    background: -moz-linear-gradient(top,#f88e11,#f06015);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11',endColorstr='#f06015');
    }
    .btn:active {
    color: #fcd3a5;
    background: -webkit-gradient(linear,from(#f47a20),to(#faa51a));
    background: -moz-linear-gradient(top,#f47a20,#faa51a);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20',endColorstr='#faa51a');
    }
    .operBtn {
    margin-top: 10px;
    width: 200px;
    text-align: center;
    }
    .tipSpan {
    display: inline-block;
    margin: 5px 2px;
    width: 200px;
    text-align: right;
    font-size: 18px;
    }
    .tipNum {
    display: inline-block;
    margin-right: 10px;
    text-align: right;
    width: 60px;
    font-size: 18px;
    }
颜色翻转

游戏规则:

单击方块,被单击的方块及相邻方块变色,当所有蓝色方块变为橙色时,完成任务,进入下一级。
次数:
次数:
原文链接:https://www.f2er.com/js/45577.html

猜你在找的JavaScript相关文章