How can I integrate chess.js and chessboard.js?

蓝咒 提交于 2020-01-07 09:51:52

问题


I am trying to integrate Chess.js and Chessboard.js but I am having some problems along the process. I have downloaded successfully Chessboard.js, unzipped the folder and within it I created a file called index.html that looks like the following:

<html>
<head>
    <title>Chess Match</title>
    <link rel="stylesheet" href="css/chessboard-0.3.0.min.css">
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="js/chessboard-0.3.0.min.js"></script>

</head>

<body>
    <div id="board" style="width: 400px"></div>
    <script type="text/javascript">
        var board = ChessBoard('board');
    </script>
</body>
</html>

This proves that the library is working properly. Now I would like to integrate the Chess.js library in order to play a random match as described in this integration page.

How can I do that?

First I need to install Chess.js so I download the repo and I put the chess.js and chess.min.js files inside the js folder, but I am not sure of how should I proceed from here. Do you have any idea?


回答1:


Add <script src="js/chess.js"></script> into your file.



来源:https://stackoverflow.com/questions/50351308/how-can-i-integrate-chess-js-and-chessboard-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!