YUI Anim 示例出错

发布于 2024-08-10 22:00:37 字数 606 浏览 1 评论 0原文

我在尝试模拟 YUI Anim 示例时遇到错误:

<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<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>

错误是:

Y.Easing 是未定义的缓动: Y.Easing.backIn\r\n

我的印象是 YUI 加载器会检索所需的文件。

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"></script>
<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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟火散人牵绊 2024-08-17 22:00:37

我从 YUI Library 论坛得到了答案,我将引用它:

YUI 将加载列出的模块及其
然而,自动要求
它不会做任何事情
全面的特征检测
发现是否还有其他东西
使用过。

您需要更改模块列表
您的 use 语句从 anim-base 到
动画(或添加动画缓动)。那么你的
例子会起作用。
-斯特凡

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

诠释孤独 2024-08-17 22:00:37

在这种情况下,添加动画缓动似乎是正确的答案 - use() 只是您需要的子模块。不过,Stefan 是正确的:您需要列出在实现中直接依赖的所有子模块。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文