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>
  • 相关阅读:
    flex产生水平滚动条
    js中的类
    typescript
    vue练习
    vue-cli2脚手架搭建
    Luogu P1970 花匠
    Luogu P1311 选择客栈
    Luogu P1016 旅行家的预算
    Luogu P1144 最短路计数
    Luogu P1091 合唱队形
  • 原文地址:https://www.cnblogs.com/weats/p/3676629.html
Copyright © 2011-2022 走看看