【问题标题】:Audio tag does not appear after hiding and showing an iframe again?隐藏并再次显示 iframe 后不出现音频标签?
【发布时间】:2013-01-17 11:54:30
【问题描述】:

我在 iframe 中加载了一个页面,该页面可能包含音频/视频标签。但是在 iPad 中,我注意到隐藏 iframe 并再次显示它会消失标签。

<button onclick="toggle();">Toggle Iframe</button>
<iframe id='page' src='http://www.quackit.com/common/html_editor_form.cfm?contentFile=../html_5/tags/inc_html_audio_tag.cfm' width="100%" frameborder='1'></iframe>

<script>
    function toggle() {
        var $el = $('#page');
        if ($el.is(':visible')) {
            $el.hide();
        } else {
            $el.show();
        }
}
</script>

演示:http://jsfiddle.net/codef0rmer/sQVCd/

有什么解决办法吗?

【问题讨论】:

    标签: html ipad css audio iframe


    【解决方案1】:

    我尝试的解决方案是使用 visibility 属性隐藏 iframe,这在 iPad 上也适用于我。

    if ($el.css('visibility') === 'visible') {
      $el.css('visibility', 'hidden');
    } else {
      $el.css('visibility', 'visible');
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-17
      • 2021-10-31
      • 2021-10-18
      • 1970-01-01
      相关资源
      最近更新 更多