【问题标题】:iframe over Google Earth Plug-In fails with Windows Firefoxiframe over Google Earth Plug-In 在 Windows Firefox 上失败
【发布时间】:2014-12-12 15:26:31
【问题描述】:

这个问题之前已经提出过,但解决方案目前在 Windows(7 Pro 64bit SP1)中的 Firefox(34.0.5)中失败。我想在 GE 插件上绘制一个 iframe。以下代码适用于

Chrome 和 Safari,以及 Firefox OSX:

但不是 Firefox for Windows:

其他 Windows 用户是否得到相同的结果?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <head>
    <title>HTML overlay</title>
    <script src="http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw"></script>
    <script>
google.load("earth", "1");

var ge = null;

function init() {
  google.earth.createInstance("map3d", initCallback, failureCallback);
}

function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
}

function failureCallback(object) {
}
    </script>
  </head>
  <body onload='init()' id='body'>
    <center>
      <div>
        header bar
        <br>
        ignore this
      </div>

      <div id='map3d' style='height:98vh; width: 100%; position: relative; z-index: 50'></div>

      <iframe src="" srcdoc="<p style='color: red;'>Let's put some HTML on top</p><br><p style='color: red;'>And some more here</p>" style='width: 200px; height: 100px; top: 0; left: 0; position: absolute; z-index: 100'></iframe>
    </center>
  </body>
</html>

【问题讨论】:

    标签: css firefox iframe google-earth-plugin


    【解决方案1】:

    您能否尝试为文本赋予以下属性:

    z-index: 100;
    

    还有谷歌地图:

    z-index: 1;
    

    并给出这两个属性:

    position:absolute; //don't apply this property in the seperate html file for the iframe
    

    【讨论】:

    • 您可以尝试将 HTML 放在地图上方的文本编辑器中
    • 也没有运气。这对你有用吗? With position: absolute..
    • 您在原始帖子中放置的代码对我有用,我只是添加了 background-color:white;正文看这里:gyazo.com/74c1eaddde64743459a73f4e02a2d779我在Windows 8上使用的是Firefox 34,你使用的是哪个版本的Firefox/Windows?
    • 啊,你是对的,插件一启动就跳转到页面最前面
    • 好吧,看来 Firefox 并没有为文本本身应用样式,而 chrome 确实如此,Firefox 只将样式应用于 iFrame 的主体,这就是滚动条在插件上方但文本不是,这也解释了为什么文本是红色的,但不会解释你的 iframe 定位的奇怪行为
    猜你喜欢
    • 1970-01-01
    • 2014-09-23
    • 1970-01-01
    • 2020-03-23
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    • 2022-08-15
    • 1970-01-01
    相关资源
    最近更新 更多