I didn't think there was anything at the time. Let's look back today and I think it's a bit interesting. I'll give it to you for identification.
First, we need to arrange the chess pieces. There is no doubt that we have to use div + css.
For specific code, see Jquery's chess board (view the source code ).
At first, I wrote classes for each piece. In fact, this is a silly behavior. First, css code is redundant. Second, it is troublesome to bind a listener to the chess part div. To determine whether a chess part div is used, I have to rely on the-B and-w Suffixes in the class name to determine whether it is used. However, if we extract the common attributes of the pawns and create a class qizi, we can solve both of these problems.
In the code, I did not specifically remove the previous code. You can see it in the annotated code. I have to write a method on both sides so that both the black and white flags can be moved. You see, this is the consequence of not doing enough abstraction.
The next step is to implement drag. For more information, see
Package
Content from: http://buhutuu.cn /? P = 783