chessboardjs icon indicating copy to clipboard operation
chessboardjs copied to clipboard

Does it work on mobile devices?

Open moroshko opened this issue 11 years ago • 5 comments

Hi,

Just wanted to know if "chessboardjs" is working on mobile, specifically the drag and drop functionality?

It would be nice to state in README.md in which browsers it was tested.

Thanks for this great project! Misha

moroshko avatar Jun 18 '14 12:06 moroshko

It should work on mobile, although I have a limited number of devices to test it on.

Pretty sure chessboard.js works in IE8 and up.

I agree this information should be added to the README.

oakmac avatar Jun 18 '14 14:06 oakmac

Hi,

I tested in an Android 7.0 with Chrome 60.0.xxx. The drag&drop moves the scroll vertically if the page has long content.

It would be nice if the pieces could also be moved first selecting the piece, and then clicking on the target square. It could be a config option apart of drag&drop.

Great job, anyway!!

osotorrio avatar Sep 15 '17 21:09 osotorrio

Hi,

I tested in an Android 7.0 with Chrome 60.0.xxx. The drag&drop moves the scroll vertically if the page has long content.

It would be nice if the pieces could also be moved first selecting the piece, and then clicking on the target square. It could be a config option apart of drag&drop.

Great job, anyway!!

Is there any solution to this? It's a great piece of software. If we could just make it so that the pieces can be selected first and moved to the specific square by clicking on that square. Thanks.

schttrj avatar Oct 31 '18 19:10 schttrj

Hi schttrj,

I made a litte site which provides saving chess diagrams as PNGs or JPGs. Take a look here: Chess Problem Printer (Sorry the site is in German, please use browser translator)

I made a switch (= just a beautified checkbox) on top of the board which sets CSS parameters to keep the webpage from scrolling. Switch on moblie mode, set up the pieces, switch off moblie mode. Simple as that.

Please tell if it works on your mobile devices. greets, hc

hcgreier avatar Oct 22 '22 22:10 hcgreier

I have fixed this issue and raised the PR https://github.com/oakmac/chessboardjs/pull/236 The culprit here is https://github.com/oakmac/chessboardjs/blob/master/lib/chessboard.js#L1658 According to the feature request on chrome call to preventDefault() becomes useless. It is simply ignored, and the screen stays scrollable.

In order to restore scroll freeze during drag event, you can use onDragStart call back to add CSS property overflow:hidden to body tag and remove this property on onSnapEnd or onDrop.

I used this and it works for me.

kgcorner avatar Jan 07 '23 18:01 kgcorner