tags:

views:

47

answers:

2

I'm getting an error when trying to emulate an YUI Anim sample:

<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"&gt;&lt;/script&gt;
<script>
   YUI().use('anim-base', function(Y){
      var anim =  new Y.Anim({
         node: '.notice',
         to: {height: 300},
         easing: Y.Easing.backIn
      });

      onClick = function(e){
         e.preventDefault();
         anim.run();
      };

      Y.get('.notice').on('click', onClick);
   });
</script>

The error is:

Y.Easing is undefined easing: Y.Easing.backIn\r\n

I was under the impression that YUI loader would retrieve the needed files.

+1  A: 

I got my answer from the YUI Library forum which I will quote:

YUI will load listed modules a their requirements automatically, however, it will not do any kind of full-fledged feature detection to discover if something else have been used.

You need to change the module list in your use statement from anim-base to anim (or add anim-easing). Then your example will work. -Stefan

Thorpe Obazee
+1  A: 

Adding anim-easing, in this case, seems like the right answer -- use() just the submodules you need. Stefan is correct, though: You need to list all the submodules that you're depending on directly in your implementation.

Eric Miraglia
Whoa, reading about myself in third-person on StackOverflow is weird. :) / Stefan
stefpet
haha. Thanks Stefan for the answer on the forums :)
Thorpe Obazee