目录

标记为Closable(Mark as Closable)

描述 (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>

输出 (Output)

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

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

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

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