【问题标题】:how to use popup in iframe that covers the whole page which contains the iframe?如何在 iframe 中使用弹出窗口来覆盖包含 iframe 的整个页面?
【发布时间】:2014-06-17 21:10:17
【问题描述】:

我想创建一个大小为 200X200 的 iframe。我想在其中使用弹出代码。但我遇到了一个问题,

当前,当我单击空间 200x200 时会显示弹出窗口,但我希望在单击具有 iframe 的页面时显示弹出窗口。 (不仅是 iframe 区域,而是整个页面)

每当我将 iframe 放在页面上时,我都希望弹出窗口出现,因为它是原始页面的弹出窗口,而不仅仅是 iframe。

任何人都知道如何使用 html、javascript 或 jquery 执行此操作?

谢谢

【问题讨论】:

    标签: javascript jquery html iframe popup


    【解决方案1】:

    使用自动调整 javascript 代码

    <script type="Text/JavaScript" language="JavaScript">
    <!--
    function resize_iframe()
    {
        var height=window.innerWidth;//Firefox
        if (document.body.clientHeight)
        {
            height=document.body.clientHeight;//IE
        }
        //resize the iframe according to the size of the
        //window (all these should be on the same line)
        document.getElementById("cam").style.height=parseInt(height-
        document.getElementById("cam").offsetTop-8)+"px";
    }
    
    // this will resize the iframe every
    // time you change the size of the window.
    window.onresize=resize_iframe; 
    
    //Instead of using this you can use: 
    //  <BODY onresize="resize_iframe()">
    
    </script>
    </head>
    <body>
    <iframe id="cam" width="100%" scrolling="yes" src="http://www.your_page.com" onload="resize_iframe()">
    </iframe>
    </body>
    

    这对你有帮助

    【讨论】:

      【解决方案2】:

      当用户点击正文元素时进行弹出调用,而不仅仅是框架。 如果您提供 JavaScript 和 HTML 代码,我可以为您提供更多帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-05-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多