javascript to read the values of the draggable and move them accordingly