AdminLTELogo

Toasts 外掛程式

Toasts 外掛程式提供簡單的功能,可輕鬆建立 Bootstrap Toast。

用法

此外掛程式可以作為 jQuery 外掛程式啟用。

jQuery

jQuery API 提供更多可自訂的選項,讓開發人員可以處理勾選和取消勾選待辦事項清單核取方塊的事件。

$(document).Toasts('create', {
  title: 'Toast Title',
  body: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr.'
})
選項
名稱 類型 預設值 描述
position 字串 Position.TOP_RIGHT Toast 的位置,可用選項:topRighttopLeftbottomRight & bottomLeft
fixed 布林值 true 是否設定 Toast 容器為固定。
autohide 布林值 布林值 是否自動隱藏 Toast
autoremove 布林值 true 是否在關閉後自動移除 Toast
delay 整數 1000 自動隱藏延遲
fade 布林值 true 是否淡入淡出 Toast
icon 字串 null 圖示類別 (例如 fas fa-exclamation-triangle)
image 字串 null 圖片網址
imageAlt 字串 null 圖片替代文字
imageHeight 字串 ‘25px’ Toast 的圖片大小
title 字串 null Toast 的標題
subtitle 字串 null Toast 的副標題
close 布林值 true 是否在 Toast 中加入關閉按鈕
body 字串 null Toast 的內容
class 字串 null Toast 的其他類別
事件

所有事件都會傳送到 body

事件類型  描述
init.lte.toasts   在建構函式完成時觸發
created.lte.toasts   在建立 Toast 時觸發
removed.lte.toasts   在移除 Toast 時觸發

範例:$('body').on('created.lte.toast', handleCreateEvent)

方法
方法 描述
create  建立 Toast

範例:$(document).Toasts('create', {title: 'Toast Title'})