【问题标题】:Fullpage js stops scrolling inside iframeFullpage js停止在iframe内滚动
【发布时间】:2017-10-13 04:55:15
【问题描述】:

我在我的网站上使用整页 js,并在其中一个部分中包含了 iframe。

example issue

如果您移至上例中的最后一部分,除非您滚动到 iframe 之外,否则您将无法进一步向下滚动。我发现整页中的这个方法可以用来向上移动一个部分。 fullpage method

$(document).on('click', '#moveUp', function(){
$.fn.fullpage.moveSectionUp();
});

此代码还可用于检测 iframe 是否已到达底部。 example iframe reaching bottom

$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) 
alert('Bottom reached');
});

link 中也讨论了这个问题,但我无法理解作为解决方案的解释。 iframe 到达顶部或底部后,如何使用这两个示例使页面上下滚动?

【问题讨论】:

    标签: javascript jquery html iframe fullpage.js


    【解决方案1】:

    完全符合预期。

    如果您想使用可滚动内容,则必须使用 fullpage.js 提供的 scrollOverflow 选项。请参阅示例 here

    否则,您必须自己编写代码检测该 iframe 中的滚动条并检测它何时到达底部,然后调用 fullpage.js 函数,例如 $.fn.fullpage.moveSectionDown()

    【讨论】:

      【解决方案2】:

      为 iframe 命名。获取 iframe.window。然后添加 scrollEvent 监听器

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-25
        相关资源
        最近更新 更多