<acidjs-xchessboard id="xchessboard-01" boxsize="64">
<acidjs-xchessboard-piece data-bind='{"type":"rook", "color":"white", "position": "a1"}’></acidjs-xchessboard-piece>
<acidjs-xchessboard-piece data-bind='{"type":"knight", "color":"white", "position": "c3"}’></acidjs-xchessboard-piece>
<acidjs-xchessboard-piece data-bind='{"type":"bishop", "color":"white", "position": "c1"}’></acidjs-xchessboard-piece>
[…]
<acidjs-xchessboard-piece data-bind='{"type":"pawn", "color":"black", "position": "f7"}’></acidjs-xchessboard-piece>
<acidjs-xchessboard-piece data-bind='{"type":"pawn", "color":"black", "position": "g7"}’></acidjs-xchessboard-piece>
<acidjs-xchessboard-piece data-bind='{"type":"pawn", "color":"black", "position": "h5"}’></acidjs-xchessboard-piece>
</acidjs-xchessboard>
[/sourcecode]
Produces this beautiful chessboard:
Using it, you may define as many pieces as you need, and you can also specify their type, color and position on the board, using the data-bind attribute of the <acidjs-xchessboard-piece></acidjs-xchessboard-piece> tag:
[sourcecode language=”javascript”]
{
"type":"pawn",
"color":"black",
"position": "h5"
}
[/sourcecode]
As usual – here’s the link to the demo, the code and the download, and on my HTML5, CSS3 and JavaScript Experiments and Insight website there’s a lot of other stuff that you may find useful.
Cheers and until later! See you on Twitter!
© 2006 - 2023 Martin Ivanov