Hướng dẫn alert bootstrap 4 - cảnh báo bootstrap 4

Cung cấp các thông báo phản hồi theo ngữ cảnh cho các hành động người dùng điển hình với một số thông báo cảnh báo linh hoạt và có sẵn.

Ví dụ

Cảnh báo có sẵn cho bất kỳ độ dài văn bản nào, cũng như nút DISMISS tùy chọn. Để biết kiểu dáng phù hợp, hãy sử dụng một trong tám lớp theo ngữ cảnh cần thiết [ví dụ: .alert-success]. Để loại bỏ nội tuyến, hãy sử dụng plugin jQuery cảnh báo.required contextual classes [e.g., .alert-success]. For inline dismissal, use the alerts jQuery plugin.


  This is a primary alert—check it out!
This is a secondary alert—check it out! This is a success alert—check it out! This is a danger alert—check it out! This is a warning alert—check it out! This is a info alert—check it out! This is a light alert—check it out! This is a dark alert—check it out!

Truyền đạt ý nghĩa để hỗ trợ các công nghệ

Sử dụng màu sắc để thêm ý nghĩa chỉ cung cấp một dấu hiệu trực quan, sẽ không được chuyển đến người dùng các công nghệ hỗ trợ - chẳng hạn như đầu đọc màn hình. Đảm bảo rằng thông tin được biểu thị bằng màu là rõ ràng từ chính nội dung [ví dụ: văn bản có thể nhìn thấy] hoặc được bao gồm thông qua các phương tiện thay thế, chẳng hạn như văn bản bổ sung ẩn với lớp .sr-only.

Màu sắc liên kết

Sử dụng lớp tiện ích


  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
0 để nhanh chóng cung cấp các liên kết màu phù hợp trong bất kỳ cảnh báo nào.


  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.

Nội dung bổ sung

Cảnh báo cũng có thể chứa các yếu tố HTML bổ sung như tiêu đề, đoạn văn và bộ chia.


  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.

Gạt bỏ

Sử dụng plugin JavaScript cảnh báo, nó có thể loại bỏ bất kỳ cảnh báo nào. Đây là cách: làm thế nào:

Bạn có thể thấy điều này trong hành động với bản demo trực tiếp:


  Holy guacamole! You should check in on some of those fields below.
  
    ×
  

Hành vi JavaScript

Gây nên

Bật việc bác bỏ cảnh báo thông qua JavaScript:

$['.alert'].alert[]

Hoặc với các thuộc tính


  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
8 trên một nút trong cảnh báo, như đã trình bày ở trên:within the alert, as demonstrated above:


  ×

Lưu ý rằng việc đóng một cảnh báo sẽ loại bỏ nó khỏi DOM.

Phương pháp

Phương phápSự mô tả

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
9
Làm cho một cảnh báo lắng nghe các sự kiện nhấp chuột trên các yếu tố hậu duệ có thuộc tính

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
4. [Không cần thiết khi sử dụng tự động hóa dữ liệu-API.]

  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.

1
Đóng một cảnh báo bằng cách loại bỏ nó khỏi DOM. Nếu các lớp

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
6 và

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
7 có mặt trên phần tử, cảnh báo sẽ mờ dần trước khi xóa.

  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.

4
Phá hủy một yếu tố cảnh báo.
$[".alert"].alert['close']

Sự kiện

Plugin cảnh báo Bootstrap, hiển thị một vài sự kiện để kết nối với chức năng cảnh báo.

Biến cốSự mô tả

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
9
Làm cho một cảnh báo lắng nghe các sự kiện nhấp chuột trên các yếu tố hậu duệ có thuộc tính

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
4. [Không cần thiết khi sử dụng tự động hóa dữ liệu-API.]

  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.

1
Đóng một cảnh báo bằng cách loại bỏ nó khỏi DOM. Nếu các lớp

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
6 và

  This is a primary alert with an example link. Give it a click if you like.


  This is a secondary alert with an example link. Give it a click if you like.


  This is a success alert with an example link. Give it a click if you like.


  This is a danger alert with an example link. Give it a click if you like.


  This is a warning alert with an example link. Give it a click if you like.


  This is a info alert with an example link. Give it a click if you like.


  This is a light alert with an example link. Give it a click if you like.


  This is a dark alert with an example link. Give it a click if you like.
7 có mặt trên phần tử, cảnh báo sẽ mờ dần trước khi xóa.
$['#myAlert'].on['closed.bs.alert', function [] {
  // do something…
}]

Bài Viết Liên Quan

Chủ Đề