Toasts ใน bootstrap4

ตอบกระทู้

รูปแสดงอารมณ์
: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] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: Toasts ใน bootstrap4

Toasts ใน bootstrap4

โดย abdkode » 08/01/2019 5:32 pm

Toast(โทซท) เป็น Popup หรือ alert ที่จะแจ้งเตือนข้อความบนหน้าจอที่เราใช้งานอยู่ ซึ่งมันสามารถหายไปโดยอัตโนมัติ
ตัวอย่างการเขียน Toast ใน bootstrap4

รูปภาพ

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

<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
  <div class="toast-header">
    <img src="..." class="rounded mr-2" alt="...">
    <strong class="mr-auto">Bootstrap</strong>
    <small>11 mins ago</small>
    <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
  <div class="toast-body">
    Hello, world! This is a toast message.
  </div>
</div>
เราสามารถเรียกใช้งาน โดยใช้ javascript ได้ดังนี้

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

$('.toast').toast('show') 
ข้อมูลเพิ่มเติมเกี่ยวกับ Toast ใน bootstrap4

ข้างบน