我在iframe中嵌入了一个typeform表单,但我不希望它在iframe本身中滚动。
下面是我的代码:
<html>
<head>
<title>Project</title>
</head>
<body>
<iframe class="typeform-widget"
src="https://weblify.typeform.com/to/WDbDw2" data-transparency="50"
data-hide-headers=true data-hide-footer=true style="width: 100%; height: 500px;">
</iframe>
<script>
(function() { var qs,js,q,s,d=document, gi=d.getElementById, ce=d.createElement, gt=d.getElementsByTagName, id="typef_orm", b="https://embed.typeform.com/"; if(!gi.call(d,id)) { js=ce.call(d,"script"); js.id=id; js.src=b+"embed.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(js,q) } })
</script>
</body>
</html>有谁知道解决方案吗?
发布于 2018-10-10 22:55:29
我想知道您是否真的需要使用iframe元素,也许是因为您的上下文。
从Typeform's embed SDK和他们的一个examples中,我看到他们使用带有id="my-embedded-typeform"的div,然后加载embed SDK脚本和自定义脚本来配置和触发它。
<div id="my-embedded-typeform"
style="width: 100%; height: 300px;"></div>
<script src="https://embed.typeform.com/embed.js" type="text/javascript">`enter code here`</script>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function() {
var el = document.getElementById("my-embedded-typeform");
// When instantiating a widget embed, you must provide the DOM element
// that will contain your typeform, the URL of your typeform, and your
// desired embed settings
window.typeformEmbed.makeWidget(el, "https://admin.typeform.com/to/cVa5IG", {
hideFooter: true,
hideHeaders: true,
opacity: 0
});
});
</script>他们在他们的文档中mention说,不推荐使用自定义脚本嵌入,因为它们可能会导致滚动问题(以及其他问题)。
也许遵循their guides可以帮助你实现你的目的,或者至少让它更易于管理。
我希望这对你有帮助!
发布于 2018-10-10 20:48:21
尝尝这个
.typeform-widget:before {
content: '';
width: 100px;
height: 500px;
position: absolute;
background: #FFF;
left: 94%;
}
https://stackoverflow.com/questions/52740573
复制相似问题