使用 fullPage.js moveTo 有什么问题?

What is the problem for using fullPage.js moveTo?

我想制作一个按钮来移动特定页面...比如如果我单击 #move_to_slide2,然后页面移动到 slide2,但是 moveTo 函数不起作用。

只有一节和 4 张幻灯片。

如何移动到按钮?

<div class="section" anchor="s0">
    <div class="slide" data-anchor="slide1">
        <div class="container w-1/3 mx-auto">
            <div class="my-40">
                <form method="POST" enctype="multipart/form-data">
                    {% csrf_token %}
                    <div class="text-xl font-bold text-center text-unifolio-blue">Getting Started</div>
                    <div class="flex w-full mt-5 items-center justify-center">
                        <p id="move_to_slide1">
                        <p class="w-full h-6 rounded-full bg-unifolio-blue cursor-pointer"></p>
                        </p>
                        <div class="h-px w-full bg-gray-400"></div>
                        <p id="move_to_slide2">
                        <p class="w-full h-6 rounded-full bg-gray-400 cursor-pointer"></p>
                        </p>
                        <div class="h-px w-full bg-gray-400"></div>
                        <p id="move_to_slide3">
                        <p class="w-full h-6 rounded-full bg-gray-400 cursor-pointer"></p>
                        </p>
                        <div class="h-px w-full bg-gray-400"></div>
                        <div class="flex w-full mb-5 items-center text-center justify-center">
                            <p id="move_to_slide1">
                            <p class="w-full h-6 text-xs text-unifolio-blue cursor-pointer">아이디 및 비밀번호 설정</p>
                            </p>
                            <div class="h-px w-full bg-white"></div>
                            <p id="move_to_slide2">
                            <p class="w-full h-6 text-xs text-gray-400 cursor-pointer">개인정보 입력</p>
                            </p>
                            <div class="h-px w-full bg-white"></div>
                            <p id="move_to_slide3">
                            <p class="w-full h-6 text-xs text-gray-400 cursor-pointer">핸드폰 인증</p>
                            </p>
                            <div class="h-px w-full bg-white"></div> 

这是我的脚本。

<script>
    $(document).ready(function() {
        $('#fullpage').fullpage({
            //options here
            autoScrolling:true,
            scrollHorizontally: true
        });
        $('#move_to_slide1').click(function(){
        fullpage_api.moveTo(1,slide1);
        });
        $('#move_to_slide2').click(function(){
        fullpage_api.moveTo(1,slide2);
        });
        $('#move_to_slide3').click(function(){
        fullpage_api.moveTo(1,slide3);
        });
        $('#move_to_slide4').click(function(){
        fullpage_api.moveTo(1,slide4);
        });
    });
</script>

您没有将正确的参数传递给 moveTo。* 第二个参数应该是幻灯片锚 string 或幻灯片索引。

例如:

fullpage_api.moveTo(1, 1); // using slide index
fullpage_api.moveTo(1, 'slide1');  // using slide anchor