我有這個代碼是提供用戶信息消息在頁面頂部, 目前它的存在,直到用戶點擊X按鈕,我的問題是如果有一種方式 刪除像2秒後自動淡出此消息,如果用戶不點擊X?兩秒後刪除信息消息
function addessage(message) {
$messages.html("<div class='alert alert-info'><strong>Information : </strong>" + message + "<button type='button' class='close' aria-hidden='true'>×</button></div>");
}
謝謝,我可以改變淡出更慢? –
是的,你可以用ms提供時間,例如'.fadeOut(1000)'一秒鐘,或者你可以像'.fadeOut('slow')一樣做這個。 – Jai