Draggable/Droppable for Battleship game

你。 提交于 2019-12-07 18:55:45

I found a solution using the grid option; I added the line below into your handleDrop function:

ui.draggable.draggable( "option", "grid", [ 52, 52 ] );

(It's 52x52 because the squares are 50x50, plus 1 on each side for the line width). After the ship is dragged to the board, you can then place the ship more precisely.

Here is the update jsFiddle: http://jsfiddle.net/cDqGN/1/

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