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
精彩评论