When someone click on my fields on my virtual game, i get my current left and top cordinates with this:
function moveDiv(fromSeat, toSeat){
var fromTop = $('#seat-' + fromSeat).css("top");
var fromLeft = $('#seat-' + fromSeat).css("left");
var toTop = $('#seat-' + toSeat).css("top");
var toLeft = $('#seat-' + toSeat).css("left");
/** Move a div from point {"fromTop", "fromLeft"} => {"toTop", "topLeft"} **/
}
I am stuck here, i tried to make a $(‘…’).animate({}); but could not get it working.
I want div “#test” to move from point {“fromTop”, “fromLeft”} => {“toTop”, “topLeft”}
You likely need to add the top values and add the left values and do animation using the totals
EDIT: need to convert values from string containing
pxto number to add them. Can useparseInt()to do it