Velocity JS禁用箭头键按下时的滚动
Velocity JS disable scroll on arrow key press
广泛查看了文档,但没有看到在按下箭头键时禁用滚动的参数。
我通过注释掉 "main.js" 中的以下代码解决了这个问题。 '40' 值向下箭头指示,'38' 向上。这可能有助于某人在其他脚本中隔离和删除此功能。
$(document).on('keydown', function(event){
if( event.which=='40' && !nextArrow.hasClass('inactive') ) {
event.preventDefault();
nextSection();
} else if( event.which=='38' && (!prevArrow.hasClass('inactive') || (prevArrow.hasClass('inactive') && $(window).scrollTop() != sectionsAvailable.eq(0).offset().top) ) ) {
event.preventDefault();
prevSection();
}
});
广泛查看了文档,但没有看到在按下箭头键时禁用滚动的参数。
我通过注释掉 "main.js" 中的以下代码解决了这个问题。 '40' 值向下箭头指示,'38' 向上。这可能有助于某人在其他脚本中隔离和删除此功能。
$(document).on('keydown', function(event){
if( event.which=='40' && !nextArrow.hasClass('inactive') ) {
event.preventDefault();
nextSection();
} else if( event.which=='38' && (!prevArrow.hasClass('inactive') || (prevArrow.hasClass('inactive') && $(window).scrollTop() != sectionsAvailable.eq(0).offset().top) ) ) {
event.preventDefault();
prevSection();
}
});