簡體   English   中英

無法在Foundation 5 Orbit滑塊中初始化JavaScript

[英]Cannot initialize javascript in Foundation 5 Orbit slider

我無法初始化基金會軌道滑塊。 由於我的代碼無法正常工作,因此我嚴格按照本教程中的內容進行嘗試。 因此,我正在按照Zurb Foundation網站上的教程進行操作,以構建基本的滑塊:

http://foundation.zurb.com/docs/components/orbit.html

http://foundation.zurb.com/docs/javascript.html

而且它沒有初始化滑塊。 經過多次嘗試,我不知道為什么。 我使用的代碼是下面的代碼。 如果要測試它,只需解壓縮Foundation庫並將文件夾重命名為Foundation。

加載頁面時,Chrome控制台中沒有腳本錯誤。

謝謝你的幫助

<html> 
<head>
    <script type="text/javascript" src="foundation/js/vendor/modernizr.js"></script>

</head>
<body> 


  <script src="foundation/js/vendor/jquery.js"></script>
  <script src="foundation/js/vendor/fastclick.js"></script>  
  <script src="foundation/js/foundation.min.js"></script>

  <ul data-orbit>
    <li>
      <img src="http://foundation.zurb.com/docs/assets/img/examples/satelite-orbit.jpg" alt="slide 1" />
      <div class="orbit-caption">
        Caption One.
      </div>
    </li>
    <li class="active">
      <img src="http://foundation.zurb.com/docs/assets/img/examples/andromeda-orbit.jpg" alt="slide 2" />
      <div class="orbit-caption">
        Caption Two.
      </div>
    </li>
    <li>
      <img src="http://foundation.zurb.com/docs/assets/img/examples/launch-orbit.jpg" alt="slide 3" />
      <div class="orbit-caption">
        Caption Three.
      </div>
    </li>
  </ul>


  <script>
    $(document).foundation();
  </script>

  </body> 
</html>

我想您可能忘記了添加樣式表。

<link rel="stylesheet" href="./foundation/css/normalize.css">
<link rel="stylesheet" href="./foundation/css/foundation.css">

另外,如果Foundation Foundation文件夾與html文檔位於同一文件夾中,則路徑可能應該是./foundation:

<script type="text/javascript" src="./foundation/js/vendor/modernizr.js"></script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM