基本全页设置无效?

时间:2016-11-18 21:18:52

标签: javascript jquery html css fullpage.js

我在我的网站上使用fullPage.js。我去测试它并没有像它应该的那样起作用并创建一个完整的高度页面。我尝试更改脚本和链接,以及使用不同的jQuery库。所有来源都是100%正确的。任何线索或建议?谢谢。

<!DOCTYPE html>
<html lang="en">
    <head>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="x-ua-compatible" content="ie=edge">

    <!-- Bootstrap / CSS -->
    <link rel="stylesheet" href="css/style.css" type="text/css">
    <link rel="stylesheet" type="text/css" href="jquery.fullPage.css" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.js"></script>


    </head>
    <body>

        <div id="fullpage"> <!-- Contains all content that uses FullPage-->
            <div class="section">
                <h1>hello</h1>
            </div>
            <div class="section">
                <h1>hello</h1>
            </div>
            <div class="section">
                <h1>hello</h1>
            </div>
        </div>

        <script>
            $(document).ready(function() {
                $('#wrapper').fullpage();
            });
        </script>


        <!-- jQuery first, then Tether, then Bootstrap JS. -->

        <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script>
    </body>
</html>

2 个答案:

答案 0 :(得分:1)

library :: https://cdnjs.com/libraries/fullPage.js

所以你必须改变脚本文件的src属性。 因为你使用整页的src是jquery.fullPage.js,但这是无效的。

在src属性中使用https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.js

<!DOCTYPE html>
<html lang="en">
    <head>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="x-ua-compatible" content="ie=edge">

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
        <link rel="stylesheet" href="css/style.css" type="text/css">
        <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.css" />


    </head>
    <body>

        <div id="wrapper"> <!-- Contains all content that uses FullPage-->
            <div class="section">
                <h1>hello</h1>
            </div>
            <div class="section">
                <h1>hello</h1>
            </div>
            <div class="section">
                <h1>hello</h1>
            </div>
        </div>

        <script>
            $(document).ready(function() {
                $('#wrapper').fullpage();
            });
        </script>


        <!-- jQuery first, then Tether, then Bootstrap JS. -->

        <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script>
    </body>
</html>

答案 1 :(得分:-1)

id="wrapper"更改为id="fullpage"

默认结构如下所示:

<div id="fullpage">
    <div class="section">Some section</div>
    <div class="section">
         <div class="slide"> Slide 1 </div>
         <div class="slide"> Slide 2 </div>
         <div class="slide"> Slide 3 </div>
    </div>
    <div class="section">Some section</div>
    <div class="section">Some section</div>
</div>