zoukankan      html  css  js  c++  java
  • YUI3 iframe高度自适应

    iframe.html
    
    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    <iframe id="frame1" src="iframe1.html" height="200px" frameborder="0" scrolling="no"></iframe>
    <script src="http://yui.yahooapis.com/3.15.0/build/yui/yui-min.js"></script>
    <script type="text/javascript">
    
        YUI.add('frame-modules', function(Y) {
            Y.frameOP = function(win, doc) {
                var h;
                YUI({win: win, doc: doc}).use('node', function(innerY) {
                    var innerBody = innerY.one('body');
                    h = innerY.one('body').getStyle('height');
                });
    
                return h;
            }
        }, '0.0.1', {requires: ['node', 'node-style']});
    
        YUI().use('frame-modules', function(Y) {
    
            var frame = document.getElementById('frame1'),
                win = frame.contentWindow,
                doc = frame.contentWindow.document;
            var h = Y.frameOP(win, doc);
            Y.log(h);
            Y.one('#frame1').set('height', h);
        });
    
    </script>
    </body>
    </html>
    iframe1.html
    
    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    <p>YUI3 was loaded!</p>
    </body>
    </html>
  • 相关阅读:
    Ocaml入门(3)
    Delphi数组成员丢失
    Delphi合并2个动态数组
    Delphi用指针读取数组某个元素
    Delphi函数返回数组之TList函数返回
    Delphi函数返回数组之使用TList参数
    Delphi让函数返回数组
    Delphi双向链表
    Delphi指针与string
    Delphi函数指针,用于加载DLL
  • 原文地址:https://www.cnblogs.com/weats/p/3676629.html
Copyright © 2011-2022 走看看