@noe_rls/cm-chessboard
Version:
A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.
39 lines (38 loc) • 1.33 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>cm-chessboard</title>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<link rel="stylesheet" href="styles/examples.css"/>
<link rel="stylesheet" href="../assets/styles/cm-chessboard.css"/>
</head>
<body>
<h1><a href="../">cm-chessboard</a></h1>
<h2>Example: Simple chessboards, view only</h2>
<div class="board" id="board1"></div>
<div class="board" id="board2"></div>
<br style="clear: both"/>
<pre>
new Chessboard(document.getElementById("board1"), {
position: "start"
})
new Chessboard(document.getElementById("board2"), {
position: "rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR w Gkq - 4 11",
orientation: COLOR.black
})
</pre>
<script type="module">
import {COLOR, Chessboard} from "../src/cm-chessboard/Chessboard.js"
new Chessboard(document.getElementById("board1"), {
position: "start",
sprite: {url: "../assets/images/chessboard-sprite-staunty.svg"},
})
new Chessboard(document.getElementById("board2"), {
position: "rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR w Gkq - 4 11",
sprite: {url: "../assets/images/chessboard-sprite-staunty.svg"},
orientation: COLOR.black
})
</script>
</body>
</html>