Jquery-plugins-toastr-訊息提示

來源:互聯網
上載者:User

標籤:xtend   com   lan   fadeout   逾時   ogr   ring   紅色   錯誤   

toastr是一個基於jQuery簡單、漂亮的訊息提示外掛程式,使用簡單、方便,可以根據設定的逾時時間自動消失。

1、使用很簡單,首選引入toastr的js、css檔案 
html

<link rel="stylesheet" href="/res/toastr/toastr.min.css"><script src="/res/toastr/toastr.min.js"></script>

2、效果 

3、整合使用

//常規訊息提示,預設背景為淺藍色  toastr.info("你有新訊息了!");  //成功訊息提示,預設背景為淺綠色 toastr.success("你有新訊息了!");  //警告訊息提示,預設背景為橘黃色 toastr.warning("你有新訊息了!");  //錯誤訊息提示,預設背景為淺紅色 toastr.error("你有新訊息了!");  //帶標題的訊息框toastr.success("你有新訊息了!","訊息提示");  //另一種調用方法toastr["info"]("你有新訊息了!","訊息提示");

4、自訂用法 

通過設定自訂參數,可達到不同的效果

自訂參數: 

toastr.options = {          closeButton: false,          debug: false,          progressBar: true,          positionClass: "toast-bottom-center",          onclick: null,          showDuration: "300",          hideDuration: "1000",          timeOut: "2000",          extendedTimeOut: "1000",          showEasing: "swing",          hideEasing: "linear",          showMethod: "fadeIn",          hideMethod: "fadeOut"      };  

 

參數說明: 
closeButton:false,是否顯示關閉按鈕(提示框右上方關閉按鈕); 
debug:false,是否為調試; 
progressBar:false,是否顯示進度條(設定關閉的逾時時間進度條); 
positionClass,訊息框在頁面顯示的位置

toast-top-left  頂端左邊toast-top-right    頂端右邊toast-top-center 頂端中間toast-top-full-width 頂端,寬度鋪滿整個螢幕toast-botton-right toast-bottom-lefttoast-bottom-centertoast-bottom-full-width

"onclick",點擊訊息框自訂事件 

"showDuration": "300",//顯示的動畫時間
"hideDuration": "1000",//消失的動畫時間
"timeOut": "3000", //展現時間,自動關閉逾時時間
"extendedTimeOut": "1000",//加長展示時間
"showEasing": "swing",//顯示時的動畫緩衝方式
"hideEasing": "linear",//消失時的動畫緩衝方式
"showMethod": "fadeIn",//顯示時的動畫方式,和jquery相同
"hideMethod": "fadeOut" //消失時的動畫方式,和jquery相同

Jquery-plugins-toastr-訊息提示

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.