我在我的网站上使用fullpage.js。我希望水平幻灯片自动滑动。为此,我使用以下代码。但是我在控制台中遇到错误:
Uncaught typeError:undefined is not a function.
代码:
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
anchors: ['home', 'about', 'why-us','services','team','contact'],
autoScrolling: true,
css3: true,
afterRender: function () {
setInterval(function () {
$.fn.fullpage.moveSlideRight();
}, 3000);
}
});
});
</script>
答案 0 :(得分:1)
您未正确包含所需文件。 确保它们位于您指定的位置。
正如文档中所指出的那样,正如您在the examples provided中所看到的,这是添加所需文件时必须遵循的结构。
<link rel="stylesheet" type="text/css" href="jquery.fullPage.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- This following line is needed in case of using the default easing option or when using another
one rather than "linear" or "swing". You can also add the full jQuery UI instead of this file if you prefer -->
<script src="vendors/jquery.easings.min.js"></script>
<!-- This following line needed in the case of using the plugin option `scrollOverflow:true` -->
<script type="text/javascript" src="vendors/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="jquery.fullPage.js"></script>