jQuery提示外掛程式alertify使用指南,jqueryalertify

來源:互聯網
上載者:User

jQuery提示外掛程式alertify使用指南,jqueryalertify

1.alertify外掛程式功能

主要實現提示功能,用於代替js中的alert,confirm,prompt,顯示友好的提示框

2.alertify使用方法

1.使用的檔案
主要使用三個檔案,兩個css(alertify.core.css,alertify.default.css),用於設定提示框的樣式。一個js(alertify.min.js或alertify.js),用於實現提示框的功能。

2.實現提示框代碼
alertify使用非常簡單,主要步驟為:初始化(初始化alertify)-》綁定(綁定事件)

如實現簡單的提示框、確認框和提示框

var$ = function (id) {  return document.getElementById(id);},//初始化操作reset = function () {  alertify.set({    labels : {      ok   : "確認",      cancel : "取消"    },    delay : 5000,    buttonReverse : false,    buttonFocus  : "ok"  });};//綁定$("alert").onclick = function () {   reset();   alertify.alert("提示框");   return false;};//綁定$("confirm").onclick = function () {   reset();   alertify.confirm("確認框", function (e) {     if (e) {       alertify.success("點擊確認");     } else {       alertify.error("點擊取消");     }   });   return false;};//綁定$("prompt").onclick = function () {  reset();  alertify.prompt("提示輸入框", function (e, str) {    if (e) {      alertify.success("點擊確認,輸入內容為: " + str);    } else {      alertify.error("點擊取消");    }  }, "預設值");  return false;};

顯示結果(輸入提示框):

4.alertify修改樣式
主要是修改兩個css檔案(alertify.core.css,alertify.default.css),也可以覆蓋使用。如在頁面中加入

.alertify{  width:350px;  margin-left: -205px;  border:2px solid #4ba9e6;  background:#f3faff;  border-radius:0;}

修改後顯示結果:

alertify使用說明

alertify是由html5+css3開發的外掛程式,所以完美的支援html5+css3的瀏覽器。在測試過程過,alertify在chrome與Firefox瀏覽器中顯示效果是完美的,但是在ie8一下,顯示效果有所不同,如圓角框、陰影、動畫特效等不會顯示。

以上所述就是本文的全部內容了,希望大家能夠喜歡。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.