Drag & drop question about revert behavior
|
|
Hi, Just wondering if there’s any known technique to cancel the revert action of a draggable depending on where it’s dropped? I’m using Rails to build a simple chess app as a demo for a Rails class. Players can drag pieces to move them on the board. I’m successfully using the But when dropped on an invalid square, the controller is not called (which is good), but the piece remains where it was dropped (which is bad). I’d like the piece to be reverted if the drop is not on an acceptable region. If I use I actually expected this to be the default behavior when I first learned about the Is there any way to achieve this functionality, either with RJS (hopefully?) or with direct Javascript? Thanks! |
Christophe P...
28 posts
|
Hey Jeff, I believe the special Let me know if that cut it out for you! Cheers, |
|
|
That worked perfectly! Awesome. And now I see it’s explained on p. 289 in the description of the revert option. I totally missed it before even though I read that section. Thanks again. |
Christophe P...
28 posts
|
Glad I could help. Keep reading! :-) |
4 posts, 2 voices
