Foundation アラート


アラート

Foundation は、定義済みのアラートメッセージを作成する簡単な方法を提供します:

This is a default alert box. ×
This is a secondary alert box. ×
Success! This alert box indicates a successful or positive action. ×
Info! This alert box indicates a neutral informative change or action. ×
Warning! This alert box indicates a warning that might need attention. ×
Alert! This alert box indicates a dangerous or potentially negative action. ×

アラートは、.alert-box と、必要に応じて 5 つのコンテキストクラスである .secondary.success.info.warning または .alert のうちの 1 つを付加 して作成します:

<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>
Try it Yourself »
Note Alerts will conform to 100% of the container width you put them in.

角丸のアラート

.radius.round クラスは、アラートボックスの角に丸みを追加します:

<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>

結果:

Success! Alert box with a radius.
Info! Alert box that is rounded.
Try it Yourself »

閉じアラート

アラートボックスを閉じるためには、リンクまたはボタン要素に class="close" を追加し、 foundation JS を初期化します:

<div data-alert class="alert-box">
  This is a default alert box with closing functionality.
  <a href="#" class="close">&times;</a>
</div>

<script>
// Initialize Foundation JS For Functionality
$(document).ready(function() {
    $(document).foundation();
})
</script>

結果:

This is a standard alert box with closing functionality. ×
Try it Yourself »
Note &times; (×) は、文字 "x" よりも クローズボタンとして適した HTML エンティティです。