In the third example, the issue appears to be your usage of scroll
as an attribute for the Anim constructor, which is valid for how YUI2's Scroll utility works, but YUI3's Anim is much more powerful than that.
You were close with the second attempt. Here is the code revised:
animation = new Y.Anim({
node: scrollArea,
to: {
scrollLeft: 200
}
});
animation.run();
I have moved the scrollLeft
field into the to attribute and changed the node to scrollArea
instead of content
. If you plan to perform this animated scrolling operation often, then might I suggest creating a wrapper function which reuses a single Anim object. This example may be of use to you in demonstrating such reuse.
Good luck.