漂亮靈活設定的jquery通知提示外掛程式toastr

來源:互聯網
上載者:User

標籤:

toastr是一款非常棒的基於jquery庫的非阻塞通知提示外掛程式,toastr可設定四種通知模式:成功,出錯,警告,提示,而提示視窗的位置,動畫效果都可以通過能數來設定,在官方站可以通過勾選參數來產生JS,非常的方便使用。jQ酷的另外一款jquery提示外掛程式也不錯:jQuery自訂工具提示外掛程式DarkTooltip。

使用方法:

引入核心檔案

123 <link href="toastr.css" rel="stylesheet" type="text/css" /><script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script><script src="toastr.js"></script>

寫入html代碼,這裡只需寫入觸發事件的按醜。

12345 <input type="button" name="success" id="success" value="成功"/><input type="button" name="info" id="info" value="提示"/><input type="button" name="warning" id="warning" value="警告"/><input type="button" name="error" id="error" value="錯誤"/><input type="button" name="clear" id="clear" value="清除"/>

給按鈕綁定事件

1234567891011121314151617181920212223242526272829303132333435363738394041 $(function(){    //參數設定,若用預設值可以省略以下面代    toastr.options = {        "closeButton": false, //是否顯示關閉按鈕        "debug": false, //是否使用debug模式        "positionClass": "toast-top-full-width",//彈出窗的位置        "showDuration": "300",//顯示的動畫時間        "hideDuration": "1000",//消失的動畫時間        "timeOut": "5000", //展現時間        "extendedTimeOut": "1000",//加長展示時間        "showEasing": "swing",//顯示時的動畫緩衝方式        "hideEasing": "linear",//消失時的動畫緩衝方式        "showMethod": "fadeIn",//顯示時的動畫方式        "hideMethod": "fadeOut" //消失時的動畫方式        };         //成功提示綁定        $("#success").click(function(){        toastr.success("祝賀你成功了");        })                 //資訊提示綁定        $("#info").click(function(){        toastr.info("這是一個提示資訊");        })                 //敬告提示綁定        $("#warning").click(function(){        toastr.warning("警告你別來煩我了");        })                 //錯語提示綁定        $("#error").click(function(){        toastr.error("出現錯誤,請更改");        })                 //清除視窗綁定        $("#clear").click(function(){        toastr.clear();        })    }) 

 

轉載請註明:jQ酷 » 漂亮靈活設定的jquery通知提示外掛程式toastr

漂亮靈活設定的jquery通知提示外掛程式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.