Using:
itemHolder.getBoxById()
itemBox.setCurrentPos()
itemBox.getCurrentPos()
itemBox.moveToFront()
// when sliding var movingBox=null; var targetpos=null; var timer=null; // start slide function startSlide(id,L,T){ if(timer) return; movingBox=itemHolder.getBoxById(id); movingBox.moveToFront(); targetPos={left:L,top:T}; slideBox(); } // one step in animation function slideBox(){ var p=movingBox.getCurrentPos(); if((p.left==targetPos.left)&&(p.top==targetPos.top)){ movingBox=null; targetpos=null; console.log("done"); clearTimeout(timer); timer=null; return; } // this is not too smart var newL=p.left; if(p.left < targetPos.left) newL++; else if(p.left > targetPos.left) newL--; var newT=p.top; if(p.top < targetPos.top) newT++; else if(p.top> targetPos.top) newT--; movingBox.setCurrentPos(newL,newT); // or:moveBox(movingBox.getId(),newL,newT); timer=setTimeout(slideBox,10); } // changing left and top function moveBox(id,L,T){ var theBox=itemHolder.getBoxById(id); theBox.moveToFront(); theBox.setCurrentPos(L,T); }