Foundation - 帶動畫的外掛切換



說明

動畫效果可以透過在 data-toggler data-animate 元素中使用屬性來應用於切換。使用 Motion UI 類,元素進入和退出檢視。

示例

以下示例演示了在 Foundation 中使用切換器外掛−

<!doctype html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1.0" />
      <title>Reveal Animations</title>

      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous">

      <!-- Compressed JavaScript -->
      <script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script>

      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/motion-ui/1.1.1/motion-ui.css">
   </head>

   <body>
      <h2>Example of Toggle with animation</h2>
      <button class = "button" data-toggle = "toggle">Toggle Panel</button>

      <div class = "callout" id = "toggle" data-toggler data-animate = "hinge-in-from-top slide-out-right" style = "background-color:#8BD6EE;">
         <h4>Welcome to TutorialsPoint</h4>
         <p>Lorem Ipsum is simply dummy text of the printing and typesetting
            industry.Lorem Ipsum has been the industry's standard dummy text.
         </p>
      </div>

      <script>
         $(document).ready(function() {
           $(document).foundation();
         })
      </script>
   </body>
</html>

產出

讓我們執行以下步驟,瞭解上面給出的程式碼如何工作−

  • 將上面給出的 html 程式碼儲存為 toggle_animation.html 檔案。

  • 在瀏覽器中開啟此 HTML 檔案,顯示如下所示的輸出。

foundation_plugins.htm
廣告
© . All rights reserved.