菜鸟教程小白 发表于 2022-12-11 19:36:22

javascript - 在 Cordova 应用程序中捏合以缩放/缩放 iframe


                                            <p><p>过去几天我一直在与这个问题作斗争,但无法深入了解它.. </p>

<p>我正在寻找一种将 iframe 嵌入到 cordova 应用程序(在 iOS 设备上运行)以显示外部网页并允许用户捏合以缩放/缩放 iframe 内容而不缩放主应用程序内容的方法它。 </p>

<p>cordovaView 的元数据是:</p>

<pre><code>&lt;meta name=&#34;viewport&#34; content=&#34;initial-scale=1, user-scalable=yes&#34;&gt;
</code></pre>

<p>我正在加载的 iframe 页面的元数据是:</p>

<pre><code>&lt;meta charset=&#34;utf-8&#34;&gt;
</code></pre>

<p>我用来加载内容的 iframe 是这样的:</p>

<pre><code>&lt;iframe src=&#34;&#34; zooming=&#34;true&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen width=&#34;500&#34; height=&#34;500&#34;&gt;&lt;/iframe&gt;
</code></pre>

<p>在当前状态下,iframe 将与加载的网页一起显示,但它没有保持我定义的 500 X 500 大小(它强制将 iframe 调整为页面内容的大小) 并且用户可以滚动页面以查看更多 iframe 内容,但无法放大或缩小页面以供用户查看更少或更多 iframe。</p>

<p>我在 cordova 索引文件或 iframe 本身上是否缺少允许 iOS 设备捏合和缩放内容的标签?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您现在可能已经自己解决了这个问题,但它不起作用的原因是您的 iframe 文档独立于顶级 dom。在 iframe 中注册的触摸事件等不能冒泡越过它们所在的文档的障碍。</p></p>
                                   
                                                <p style="font-size: 20px;">关于javascript - 在 Cordova 应用程序中捏合以缩放/缩放 iframe,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/48232156/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/48232156/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: javascript - 在 Cordova 应用程序中捏合以缩放/缩放 iframe