-
Notifications
You must be signed in to change notification settings - Fork 411
/
3005-orientation.example
34 lines (26 loc) · 1.06 KB
/
3005-orientation.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
===== id
3005
===== Name
Orientation
===== Description
Use the <a href="docs.html#methods:orientation"><code class="js plain">orientation</code></a> method to retrieve and set the orientation. Use the <a href="docs.html#methods:flip"><code class="js plain">flip</code></a> method to flip orientation.
===== HTML
<div id="myBoard" style="width: 400px"></div>
<button id="showOrientationBtn">Show orientation in console</button>
<button id="flipOrientationBtn">Flip orientation</button>
<br />
<button id="whiteOrientationBtn">White orientation</button>
<button id="blackOrientationBtn">Black orientation</button>
===== JS
var ruyLopez = 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R'
var board = Chessboard('myBoard', ruyLopez)
$('#showOrientationBtn').on('click', function () {
console.log('Board orientation is: ' + board.orientation())
})
$('#flipOrientationBtn').on('click', board.flip)
$('#whiteOrientationBtn').on('click', function () {
board.orientation('white')
})
$('#blackOrientationBtn').on('click', function () {
board.orientation('black')
})