首页 > 解决方案 > Fullpage.js 不会在任何浏览器(chrome、firefox、edge)中滚动

问题描述

我一直在尝试使用 fullpage.js 制作一个非常简单的网站,但它不会像预期的那样滚动整个部分。我在我的代码中包含了一个片段。CSS/JS 直接从 fullpage.css 和 fullpage.js 粘贴。我在不同的浏览器上尝试过,在隐身窗口中,禁用任何扩展或插件等......它只是不会。到目前为止,我已经发现 $(window).scroll 事件不会触发,$('#fullpage').scroll 也不会触发

我的html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>

<link rel="stylesheet" type="text/css" href="fullpage.css" />
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256- 
BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"> 
</script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" 
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" 
crossorigin="anonymous"></script>
<script type="text/javascript" src="fullpage.js"></script>
</head>

<body>

<div id="fullpage">
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
</div>

<script type="text/javascript">
$(document).ready(function() {
  $('#fullpage').fullpage({
  licenseKey: '',
  autoScrolling: true,
  sectionsColor: ['blue', 'yellow', 'green', 'red', 'brown']
  });

  $.fn.fullpage.setAllowScrolling(false);
});
</script>
</body>
</html>

codepen.io 片段

标签: javascripthtmlcssfullpage.js

解决方案


So far I've figured out the $(window).scroll event won't fire and neither will $('#fullpage').scroll

That's totally normal. Fullpage.js won't fire the scroll event.

I would encourage you to take any of the examples available as your starting point if you can't find what you are missing.


推荐阅读