function swap(fromTo, toFrom)
{
var temp = blocks[fromTo];
var templabel = BlockLabels[fromTo];
blocks[fromTo].animate({ x: blocks[toFrom].X }, 1500, ">");
BlockLabels[fromTo].animate({ x: BlockLabels[toFrom].X }, 1500, ">");
blocks[toFrom].animate({ x: temp.X }, 1500, ">");
BlockLabels[toFrom].animate({ x: templabel.X }, 1500, ">");
}
此交换功能适用于IE9但不适用于Chrome。我正在使用Raphael2.0
已更新:http://jsfiddle.net/ZgEty/ chrome和safari无法正常工作,但IE9确实
答案 0 :(得分:1)
啊......这就是你访问x的方式,就像它是一个对象属性一样。试试这个:
blocks[fromTo].animate({ x: blocks[toFrom].attr( 'x' ) }, 1500, ">");
BlockLabels[fromTo].animate({ x: BlockLabels[toFrom].attr( 'x' ) }, 1500, ">");
blocks[toFrom].animate({ x: temp.attr( 'x' ) }, 1500, ">");
BlockLabels[toFrom].animate({ x: templabel.attr( 'x' ) }, 1500, ">");