开发者

Move an element to a specified X,Y coordinate

Using the YUI API, how to move a开发者_开发技巧n element to a specified X,Y coordinate.

Return true if successful, false if an error occurs.

function moveIt(element, x, y) {
// write code here
}


In YUI2, use

YAHOO.util.Dom.setXY('foo', [100, 100]);

where foo is an id, and the second argument is an array with x and y coords.

(i.e. http://jsfiddle.net/ETHYG/4/ )


In YUI 3 use Node.setXY:

http://developer.yahoo.com/yui/3/api/Node.html#method_setXY

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜