I want to add onepagescroll on my website, I find it difficult to solve this problem, maybe because I am still learning stage.
答案 0 :(得分:0)
你必须像这样构建你的页面:
<body>
<div class="main">
<section>...</section>
<section>...</section>
</div>
</body>
每个部分标签代表一个“页面”,因此当您滚动它时,只需滚动到下一部分。
您还必须添加jquery,onepagescroll插件和在主元素上调用插件的脚本
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> //embed jquery
<script src="path/to/the/plugin/file.js"></script> //embed plugin
<script>
$( document ).ready(function() { //wait for jquery
$('#main').onepage_scroll(); //start the plugin
});
</script>
您还可以查看Barmar提到的the plugins documentation或关注a tutorial to create a demo page。