带有Datawrapper响应式iframe的空白HTML页面

时间:2018-06-22 19:44:05

标签: html iframe

我有一个新手HTML问题。我使用Sublime创建了一个.html。当我使用Firefox或IE打开文件时,出现空白页。我已经在各种实时编辑器中尝试过该代码,并且看起来是否如所期望?任何帮助将不胜感激。

这是HTML:

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<link rel="stylesheet" href="https://www.w3schools.com/w3css/3/w3.css">
<body>
<iframe id="datawrapper-chart-zhhBf" src="//datawrapper.dwcdn.net/zhhBf/1/" scrolling="no" frameborder="0" allowtransparency="true" style="width: 0; min-width: 100% !important;" height="295"></iframe><script type="text/javascript">if("undefined"==typeof window.datawrapper)window.datawrapper={};window.datawrapper["zhhBf"]={},window.datawrapper["zhhBf"].embedDeltas={"100":376,"200":349,"300":322,"400":295,"500":295,"700":295,"800":295,"900":295,"1000":295},window.datawrapper["zhhBf"].iframe=document.getElementById("datawrapper-chart-zhhBf"),window.datawrapper["zhhBf"].iframe.style.height=window.datawrapper["zhhBf"].embedDeltas[Math.min(1e3,Math.max(100*Math.floor(window.datawrapper["zhhBf"].iframe.offsetWidth/100),100))]+"px",window.addEventListener("message",function(a){if("undefined"!=typeof a.data["datawrapper-height"])for(var b in a.data["datawrapper-height"])if("zhhBf"==b)window.datawrapper["zhhBf"].iframe.style.height=a.data["datawrapper-height"][b]+"px"});</script>
</body>
</html>

0 个答案:

没有答案