简体   繁体   English

如何仅在fullpage.js中禁用鼠标滚动触发器

[英]How to disable mouse scroll trigger in fullpage.js only

In fullpage.js core functions 在fullpage.js核心功能

How to customize such that when set option autoScrolling: true. 如何自定义,当设置选项autoScrolling:true时。

1.only disable mouse scroll behavior trigger in section scrolling control. 1.仅在部分滚动控件中禁用鼠标滚动行为触发器。

2.other keyboard scroll triggers still working. 2.其他键盘滚动触发仍然有效。 (such as keyup keydown end home etc) (如keyup keydown end home等)

here is the fullpage.js code from git: https://github.com/ajgagnon/fullPage.js/blob/master/jquery.fullPage.js 这是来自git的fullpage.js代码: https//github.com/ajgagnon/fullPage.js/blob/master/jquery.fullPage.js

Explaination: why need to disable mouse scroll sometimes. 解释:为什么有时需要禁用鼠标滚动。 Because there are scroll sensitivity issues in fullpage.js when "scrollOverflow: true". 因为当“scrollOverflow:true”时,fullpage.js中存在滚动敏感性问题。 However, if you totally disabled the "autoScrolling: true" option, by default keyboard trigger still allow to scroll up down left right. 但是,如果您完全禁用了“autoScrolling:true”选项,则默认情况下键盘触发器仍允许向左上滚动。 ( "keyboardScrolling: true" by default; ) (默认情况下为“keyboardScrolling:true”;)

However, I discovered when "scrollOverflow: false" option together with "keyboardScrolling: true", the content will shake instantly the moment you press down the arrow keys. 但是,我发现当“scrollOverflow:false”选项与“keyboardScrolling:true”一起时,内容会在您按下箭头键时立即抖动。 don't know how to fix, so it's my purpose to keep scrollOverflow:true while disable mouse scroll only. 不知道如何修复,所以我的目的是保持scrollOverflow:true,同时禁用鼠标滚动。 then will be no issue. 那就没问题了。 )

How about: 怎么样:

$(function()
{
    $('#fullpage').fullpage({
        ...
    });

    $.fn.fullpage.setMouseWheelScrolling(false);
    $.fn.fullpage.setAllowScrolling(false);
});

However, if you totally disabled the "autoScrolling: true" option, by default keyboard trigger still allow to scroll up down left right. 但是,如果您完全禁用了“autoScrolling:true”选项,则默认情况下键盘触发器仍允许向左上滚动。 ( "keyboardScrolling: true" by defa (defa的“keyboardScrolling:true”

Not anymore since fullPage.js 2.4.9. 自从fullPage.js 2.4.9以来不再。 autoScrolling:false will disable the auto scroll with keyboard as well. autoScrolling:false也会禁用键盘自动滚动。

Alvaro,要禁用键盘你应该使用: keyboardScrolling: false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM