Foundation 提醒框


Foundation 可以很簡單的建立一個提醒框:

#提醒框可以使用.alert-box 類別建立, 可以新增可選的類別: .secondary, .success, .info, .warning.alert:

實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>提醒框</h2>
  <div data-alert class="alert-box">
    This is a default alert box.
  </div>

  <div data-alert class="alert-box secondary">
    This is a secondary alert box.
  </div>

  <div data-alert class="alert-box success">
    <strong>Success!</strong> This alert box indicates a successful or positive action.
  </div>

  <div data-alert class="alert-box info">
      <strong>Info!</strong> This alert box indicates a neutral informative change or action.
  </div>

  <div data-alert class="alert-box warning">
      <strong>Warning!</strong> This alert box indicates a warning that might need attention.
  </div>

  <div data-alert class="alert-box alert">
      <strong>Alert!</strong> This alert box indicates a dangerous or potentially negative action.
  </div>
</div>

</body>
</html>

運行實例»##點擊"運行實例" 按鈕查看線上實例


#提醒框的寬度為容器的100%。
Note

圓角提醒框

.radius.round 類別用來為提醒框新增圓角:

實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>圆角提醒框</h2>
  <div data-alert class="alert-box">
    Default Alert box
  </div>

  <div data-alert class="alert-box radius">
    Default Alert box with a radius.
  </div>

  <div data-alert class="alert-box secondary radius">
    Secondy Alert box with a radius.
  </div>

  <div data-alert class="alert-box success radius">
    <strong>Success!</strong> Alert box with a radius.
  </div>

  <div data-alert class="alert-box info round">
      <strong>Info!</strong> Alert box that is rounded.
  </div>

  <div data-alert class="alert-box warning round">
      <strong>Warning!</strong> Alert box that is rounded.
  </div>

  <div data-alert class="alert-box alert round">
      <strong>Alert!</strong> Alert box that is rounded.
  </div>
</div>

</body>
</html>

#執行實例»點擊"運行實例" 按鈕查看線上實例


關閉提醒框

要關閉提醒框,可以在連線或按鈕元素上新增

class="close" 類,並初始化Foundation JS :

實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>关闭提醒框</h2>
  <div data-alert class="alert-box">
    This is a default alert box.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box secondary">
    This is a secondary alert box.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box success">
    <strong>Success!</strong> This alert box indicates a successful or positive action.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box info">
    <strong>Info!</strong> This alert box indicates a neutral informative change or action.
    <a href="#" class="close">×</a>
 </div>

  <div data-alert class="alert-box warning">
    <strong>Warning!</strong> This alert box indicates a warning that might need attention.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box alert">
    <strong>Alert!</strong> This alert box indicates a dangerous or potentially negative action.
    <a href="#" class="close">×</a>
  </div>
</div>

<script>
// 创始化 Foundation JS 
$(document).ready(function() {
    $(document).foundation();
})
</script>

</body>
</html>

#執行實例»點擊"運行實例" 按鈕查看線上實例

× (×) 是一個HTML 字元實體表示一個關閉按鈕的圖標,而不是字母 "x"。
Note