Game 5 for js, css3 + js

Source: Internet
Author: User
: No image is used. All images are made of js + css. The interface is implemented, and the function is not implemented yet. Js: varconfig {row: 16, row rank: 16, column white: 112, white black: 113, black overtime: 1000*60, timeout gam

 

:

I didn't use any images, all of which were made by js + css.

The interface is implemented, and the function is not implemented yet.

Js:

 

Var config = {row: 16, // row rank: 16, // column white: 112, // white black: 113, // black overtime: 1000*60, // timeout gameState: 0, // 0 not started, 1. in progress, 2 pause in progress margin: 5, // the margin of each pawn is 5 pixels colorSign: 0, // color tag}; $ (function () {initGame () ;}); // initialize the game function initGame () {createView (); $ (. block ). click (function () {eventCLick ($ (this) ;}// create a checker function createView () {var html =
; For (var I = 0; I ; For (var k = 0; k ; // Html + = I +-+ k; html + =;} html + =
; $ (Document. body ). append (html); // create a block var width = $ (. box table ). width (); var single = (width/config. row ). toFixed (0); var leftMargin = (single/2 ). toFixed (0); var x = parseInt (leftMargin); var y = parseInt (leftMargin); // create a chess box for (var I = 0; I ; Box = box. replace ($ {h}, single-config.margin); box = box. replace ($ {w}, single-config.margin); box = box. replace ($ {x}, x + (config. margin/2) + 1); box = box. replace ($ {y}, y + (config. margin/2); $ (. box ). append (box); x + = parseInt (single);} y + = parseInt (single); x = parseInt (leftMargin);} // click the pawn function eventCLick (target) {if (config. colorSign = 0) {$ (target ). addClass (focus-black);} else {$ (target ). addClass (focus-white );}}
CSS and HTML:

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.