我正在为一家牙科诊所做一个网站,我想做一个图像滑块比较。我是用 juxtaposeJS.knightlab.com 做的,并将代码嵌入我的谷歌网站,但我不知道如何删除滚动条,尽管我已经调整了它的高度。此外,它在移动预览中也很糟糕。
这是html代码:
<iframe frameborder="0" class="juxtapose" width="100%" height="332"
<iframe src="https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=c9bdf8aa-b4bd-11ed-b5bd-6595d9b17862"></iframe>
我尝试使用谷歌搜索我在此处和其他网站上找到的其他解决方案,但要么是滚动条保留在那里,要么是图像在编辑 HTML 代码后消失了。
原始问题中提供的代码不是合法的 HTML,我怀疑这是大部分问题。解决这个问题最简单的方法可能就是给 iframe 一个足够包含内容的高度,就像这样:
<iframe src="https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=c9bdf8aa-b4bd-11ed-b5bd-6595d9b17862" frameborder="0" height="183"></iframe>
默认情况下,iframe 的高度为 150px,并且由于您嵌入的图像具有 183px 的硬编码高度,因此您将获得一个滚动条。
或者,您可以选择更动态的 JS 解决方案,例如本问题
中介绍的解决方案只需在第二个 iframe 中添加
scrolling="no"
:
<iframe frameborder="0" class="juxtapose" width="100%" height="332"
<iframe scrolling="no" src="https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=c9bdf8aa-b4bd-11ed-b5bd-6595d9b17862"></iframe>