1

I want player 2 to see what last move player 1 has moved. The best way to do this would be to highlight the last move. How is it possible in chessboard.JS?

1

I wasn't familiar with chessboard.js - but a quick search of their site turned up an example entitled Piece Highlight 1, which seems to do just that. The link includes both javascript and HTML examples, depending on which you're looking for.

Since links are not permanent, here is the HTML example:

<style type="text/css">
.highlight-white {
  -webkit-box-shadow: inset 0 0 3px 3px yellow;
  -moz-box-shadow: inset 0 0 3px 3px yellow;
  box-shadow: inset 0 0 3px 3px yellow;  
}
.highlight-black {
  -webkit-box-shadow: inset 0 0 3px 3px blue;
  -moz-box-shadow: inset 0 0 3px 3px blue;
  box-shadow: inset 0 0 3px 3px blue;  
}
</style>
<script src="js/chess.js"></script>
<div id="board" style="width: 400px"></div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.