การใช้ Closing Alerts ใน Bootstrap

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: การใช้ Closing Alerts ใน Bootstrap

การใช้ Closing Alerts ใน Bootstrap

โดย Parichat » 11/01/2018 2:57 pm

Closing Alerts คือ เมื่อต้องการปิดการแจ้งเตื่อนโดยให้เพิ่ม class .alert-dismissable ไปยังcontainer การแจ้งเตือน จากนั้นเพิ่ม class = "close" และ data-dismiss = "alert" ไปที่ link หรือ button element (เมื่อคลิกที่กล่องข้อความแจ้งเตือนจะหายไป)
ตัวอย่าง

โค้ด: เลือกทั้งหมด

<!DOCTYPE html>
<html lang="en">
<head>
  <title>ทดสอบ Closing Alerts</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>ทดสอบการใช้งาน Closing Alerts</h2>
  
  <div class="alert alert-danger alert-dismissable">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>A!</strong> Hi MindPHP A.
  </div>
  <div class="alert alert-success alert-dismissable">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>B!</strong> Hi MindPHP B.
  </div>
  <div class="alert alert-info alert-dismissable">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>C!</strong> Hi MindPHP C.
  </div>
  <div class="alert alert-warning alert-dismissable">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>D!</strong> Hi MindPHP D.
  </div>
</div>

</body>
</html>
ผลลัพธ์
rgl.JPG
อ้างอิง : https://www.w3schools.com/bootstrap/boo ... alerts.asp
https://www.w3schools.com/bootstrap/try ... &stacked=h

ข้างบน