การใช้ Closing Alerts ใน Bootstrap

Booststap Knowledge ความรู้สำหรับการออกเว็บเพื่อให้แสดงผล ได้ดี ทุกหน้าจอ

Moderator: mindphp, ผู้ดูแลกระดาน

Parichat
PHP VIP Members
PHP VIP Members
โพสต์: 4859
ลงทะเบียนเมื่อ: 08/01/2018 10:03 am

การใช้ Closing Alerts ใน Bootstrap

โพสต์ที่ยังไม่ได้อ่าน โดย Parichat »

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
Live Simply, Laugh Often, Love Deeply.....
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 34