【问题标题】:How to allow scrolling inside Shadowbox iframe?如何允许在 Shadowbox iframe 内滚动?
【发布时间】:2014-03-21 20:20:55
【问题描述】:

我使用 Shadowbox 一次显示多个 iframe (http://www.shadowbox-js.com/)。

我尝试了这个解决方案: IFRAMEs and the Safari on the iPad, how can the user scroll the content?

但是没有运气。

生成的 iframe 的语法是:

<div id="sb-body">
    <div id="sb-body-inner">
        <iframe id="sb-player">
            //iframe content
        </div>
    </div>
</div>

任何想法如何解决这个问题?我使用 iframe 的方式需要滚动。

【问题讨论】:

  • 使用overflow-y:scroll;,不过要看孩子的height,是否超过parent containerheight

标签: html css iframe shadowbox


【解决方案1】:

试试这个,这样它就不会在其他设备上创建双滚动条。

 $(window).load(function(){

            if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {

                $('#sb-body-inner').css({
                    'overflow': 'scroll', 
                    '-webkit-overflow-scrolling': 'touch' 
                }); 

            }
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-05
    相关资源
    最近更新 更多