【问题标题】:How to make scrolling inside section work with FullPageJs?如何使用 FullPage Js 在部分内滚动?
【发布时间】:2016-07-07 17:03:45
【问题描述】:

我正在尝试使用 FullPageJs 并在部分内进行滚动,但即使我按照推荐添加了超薄滚动插件,页面也不会在桌面上滚动。

这是我正在使用的代码

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>

    <script type="text/javascript" src="../vendors/scrolloverflow.js"></script>
<script type="text/javascript" src="../vendors/jquery.slimscroll.min.js"></script>

    <script type="text/javascript" src="../jquery.fullPage.js"></script>
    <script type="text/javascript" src="examples.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $('#fullpage').fullpage({
                anchors: ['firstPage', 'secondPage', '3rdPage', '4thPage'],
                sectionsColor: ['#4A6FB1', '#939FAA', '#323539'],
                scrollOverflow: true,
                scrollOverflowOptions: {
                    scrollbars: true,
                    mouseWheel: true,
                    hideScrollbars: false,
                    fadeScrollbars: false,
                    disableMouse: true
                }
            });
        });
    </script>

页面在桌面上没有移动,这里是demo。该页面仅在我将 disableMouse 更改为 false 时才会移动,但随后它只会像在移动设备上一样移动。我必须点击并滚动。

问题

如何使部分内的滚动正常工作?

【问题讨论】:

    标签: javascript jquery fullpage.js


    【解决方案1】:

    你有an example available in the files that comes with the download of fullpage.js

    同样的online

    fullpage.js 不再使用 slimScroll.js,您可以在文档中看到:

    scrollOverflow:(默认为 false)定义是否为部分/幻灯片创建滚动,以防其内容大于其高度。当设置为 true 时,您的内容将被插件包装。考虑在 afterRender 回调中使用委托或加载其他脚本。如果将其设置为 true,则需要供应商库 scrolloverflow.min.js 并且应该在 fullPage.js 插件之前加载它。例如:

    <script type="text/javascript" src="vendors/scrolloverflow.min.js"></script>
    <script type="text/javascript" src="jquery.fullPage.js"></script>
    

    只有当我将 disableMouse 更改为 false 时页面才会移动

    您不必修改任何滚动溢出选项。如果您想要默认行为,请删除您的 scrollOverflowOptions

    【讨论】:

    • 这正是问题所在。请尝试在桌面上滚动页面,您会看到在您刚刚在alvarotrigo.com/fullPage/examples/scrolling.html 给我的示例中它没有滚动它在 Windows 和 Chrome 上使用 Mozilla firefox 47.0.1 时都没有在桌面上滚动。但它可以在移动设备上滚动。
    • 它在最新的 Firefox 和 Chrome for Windows 中完美滚动。如果您愿意,可以在 Browserstack 中对其进行测试。无论如何,没有人对此抱怨过,所以问题很可能在你身边。
    • 真的,连 Browserstack 都没有在我的 windows 10 上滚动,除了这些之外,一切都在我的 windows 10 上完美运行。
    • 我也有同样的问题。它适用于 Windows 10 上的 IE,但不适用于 Mozilla、Chrome 或 Opera。我也有 windows 10 pro 64 位
    • 正常滚动选项可以完美运行,但不能在部分内滚动。任何帮助将不胜感激
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多