目录

Orbit

描述 (Description)

Orbit是一个简单而强大的滑块,使用orbit类滑动元素。

例子 (Example)

以下示例演示了在基础中使用orbit -

<html>
   <head>
      <title>Orbit</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/motion-ui/1.1.1/motion-ui.css">
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
   </head>
   <body>
      <h2 class = "text-center">Orbit Example</h2>
      <div class = "orbit" role = "region" data-orbit data-use-m-u-i = "false">
         <ul class = "orbit-container">
            <button class = "orbit-previous" aria-label = "previous"><span class = "show-for-sr">Previous Slide</span>◀</button>
            <button class = "orbit-next" aria-label = "next"><span class = "show-for-sr">Next Slide</span>▶</button>
            <li class = "is-active orbit-slide">
               <div>
                  <h3 class = "text-center">This is your first slider</h3>
                  <p class = "text-center">Foundation is a family of responsive front-end frameworks that make it easy to design beautiful responsive websites, apps and emails that look amazing on any device. </p>
               </div>
            </li>
            <li class = "orbit-slide">
               <div>
                  <h3 class = "text-center">This is your second slider</h3>
                  <p class = "text-center">Foundation is a family of responsive front-end frameworks that make it easy to design beautiful responsive websites, apps and emails that look amazing on any device. </p>
               </div>
            </li>
            <li class = "orbit-slide">
               <div>
                  <h3 class = "text-center">This is your third slider</h3>
                  <p class = "text-center">Foundation is a family of responsive front-end frameworks that make it easy to design beautiful responsive websites, apps and emails that look amazing on any device. </p>
               </div>
            </li>
            <li class = "orbit-slide">
               <div>
                  <h3 class = "text-center">This is your fourth slider</h3>
                  <p class = "text-center">Foundation is a family of responsive front-end frameworks that make it easy to design beautiful responsive websites, apps and emails that look amazing on any device. </p>
               </div>
            </li>
         </ul>
         <nav class = "orbit-bullets">
            <button class = "is-active" data-slide = "0">
               <span class = "show-for-sr">First slide</span>
               <span class = "show-for-sr">Current Slide</span>
            </button>
            <button data-slide = "1">
               <span class = "show-for-sr">Second slide</span>
            </button>
            <button data-slide = "2">
               <span class = "show-for-sr">Third slide</span>
            </button>
            <button data-slide = "3">
               <span class = "show-for-sr">Fourth slide</span>
            </button>
         </nav>
      </div>
      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 保存上面给出的html代码orbit.html文件。

  • 在浏览器中打开此HTML文件,输出显示如下。

新页面打开
↑回到顶部↑
WIKI教程 @2018