如何用YUI获取窗口的宽度和高度?

发布于 2024-09-27 09:31:33 字数 102 浏览 0 评论 0原文

我如何获得这些值?我在 YUI 页面上看到了执行此操作的示例,但使用了单击事件,然后在事件目标上调用 get('winWidth') 方法。但是如何在不使用任何事件的情况下获得这些值呢?谢谢

How do I get those values? I see the example on the YUI page to do this but using a click event, and then calling the get('winWidth') method on the event target. But how can I get these values without the use of any event? Thanks

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

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

发布评论

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

评论(1

半暖夏伤 2024-10-04 09:31:33

YAHOO.util.Dom.getViewportWidth();
YAHOO.util.Dom.getViewportHeight();

记住,您可以减少 YUI 命名空间,如下所示

(function() {
    var Yutil = YAHOO.util,

         Ydom = Ytil.Dom;

    Ydom.getViewportWidth();
    Ydom.getViewportHeight();
})();

Simply

YAHOO.util.Dom.getViewportWidth();
YAHOO.util.Dom.getViewportHeight();

keep in mind you can reduce YUI namespace as shown bellow

(function() {
    var Yutil = YAHOO.util,

         Ydom = Ytil.Dom;

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