When you want to use jschess there are two options. One is to use the .min.js file in which case you need to import all third party modules yourself. The second is to use the .pack.js file in which case you get all the third parties built in.
When using the .pack.js file download it from here. Place the file somewhere on your web server and import it from your HTML like this:
<script src="jschess.pack.js"></script>
You need a place for your board, so place something like this somewhere in your html:
<div id="myid"></div>
In order to get a board with initial position we must:
The SvgBoard will also need the id you prepared since it is the one doing the actual drawing on the screen. To do "chess stuff" we will mainly interact with the board: move pieces, delete pieces etc. So we will also call the startPosition method to setup a classic chess start position.
var board=new Board()
var svgBoard=new SvgBoard(board,{
id:'myid'
})
board.startPosition()
Here is the result:
Copyright Mark Veltzer © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 mark.veltzer@gmail.com