How do I force jquery to center an element when it snaps to another container using the draggable method?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2012-07-09T03:09:35Z Indexed on 2012/07/09 3:15 UTC
Read the original article Hit count: 198

Here's my script. I want some square-shaped draggable objects (in this case just td boxes with numbers in them) to be able to snap to some empty table cells and snap to the center of those cells (empty td boxes), not the top or bottom of those cells, which is what is seems to do by default.

<script type="text/javascript">
  $(document).ready(function () {


$(".inputs div").draggable( {
    snap: ".spaces"

   }

   );   

}); 
</script>

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about draggable