Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
Link color
.alert-link クラスを適用すると, リンクが適切なカラーになります。
A simple primary alert with an example link. Give it a click if you like.
A simple secondary alert with an example link. Give it a click if you like.
A simple success alert with an example link. Give it a click if you like.
A simple danger alert with an example link. Give it a click if you like.
A simple warning alert with an example link. Give it a click if you like.
A simple info alert with an example link. Give it a click if you like.
A simple light alert with an example link. Give it a click if you like.
A simple dark alert with an example link. Give it a click if you like.
Additional content
アラートには, 見出し, 段落, 仕切りなどのHTML要素を含めることができます。
Well done!
Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
Holy guacamole! You should check in on some of those fields below.
JavaScript behavior
Triggers
JavaScript経由でアラート閉じるを有効にします。
上記のように, アラート内のボタンに data 属性を設定することも可能です。
アラートを閉じると, アラートがDOMから削除されます。
Methods
Method
Description
$().alert()
Makes an alert listen for click events on descendant elements which have the data-dismiss="alert" attribute. (Not necessary when using the data-api’s auto-initialization.)
$().alert('close')
Closes an alert by removing it from the DOM. If the .fade and .show classes are present on the element, the alert will fade out before it is removed.
$().alert('dispose')
Destroys an element’s alert.
Events
Bootstrapのアラートプラグインは, アラート機能のためにいくつかのイベントがあります。
Event
Description
close.bs.alert
This event fires immediately when the close instance method is called.
closed.bs.alert
This event is fired when the alert has been closed (will wait for CSS transitions to complete).