YUI Animation Example
HTML
<html>
<head></head>
<body>
<p>Click this all you want, the animation will only fire once:</p>
<div id="steve"></div>
</body>
</html>
CSS
#steve {
width: 50px;
height: 50px;
background: blue;
}
JavaScript
YUI().use('anim', function (Y) {
var someElement = Y.one('#steve');
var a = new Y.Anim({
node: someElement,
duration: 10,
to: {
width: 300
}
});
a.on('end', function() {
someElement.remove(true);
console.log('done');
});
someElement.on('click', function() {
console.log('clicked');
if (!a.get('running')) {
console.log('running');
a.run();
}
});
});