标记为Closable(Mark as Closable)

优质
小牛编辑
123浏览
2023-12-01

描述 (Description)

包含data-closable属性以关闭元素; 当元素退出时,也可以应用动画效果。 如果要在元素内添加单击触发器,则包括data-close属性。

例子 (Example)

以下示例演示了在Foundation中使用toggler插件 -

<!doctype html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1.0" />
      <title>Foundation Template</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>Example of Toggle with closable</h2>
      <div class = "callout" data-closable = "spin-out" style = "background-color:#8BD6EE;">
         <button class = "close-button" data-close>×</button>
         <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>