fullPage.js won't scroll
-
21-12-2019 - |
Question
I'm surprised I couldn't find the answer to this problem before. I tried to incorporate the fullpage plugin into my site and basically disabled the scrolling function. It is stuck on the first section. I tried to make a simplified version, cutting everything to the bone, same issue.
in the head section...
<link href="css/jquery.fullPage.css" rel="stylesheet" type="text/css" media="screen">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="scripts/jquery.fullPage.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$.fn.fullpage();
});
</script>
In the body section...
<body>
<header class="section">
<div><h1>A</h1></div>
</header>
<main>
<section class="section">
<div><h1>B</h1></div>
</section>
<section class="section">
<div><h1>C</h1></div>
</section>
</main>
</body>
What's going on? Thanks in advance.
Solution
You are not following the required structure for the plugin.
Your class="section"
elements should be at the same level as pointed out in the documentation. You can not have a section inside <main>
. It should be at the same level.
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
Also, if you are using the last version of the plugin, you should use a wrap for all the sections and use it also at the initialization:
<div id="fullpage">
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
<div class="section">Some section</div>
</div>
Initialization:
$(document).ready(function() {
$('#fullpage').fullpage();
});