alertify.js 介绍
alertifyjs是 一个 非侵入式,可定制的JavaScript 通知 组件。 包括 可定制的对话框,和右下角消息弹出框。完全可定制的警报,确认和 提示 对话框、完全 自定义 的 通知 系统、回调参数处理 包括 “确定“和”取消“按钮的点击、允许对话框排队
alertifyjs安装
直接引入
<-- 标准版 -->
<script src="https://cdn.rawgit.com/alertifyjs/alertify.js/v1.0.10/ dis t/js/alertify.js"></script>
<-- angular模块 -->
<script src="https://cdn.rawgit.com/alertifyjs/alertify.js/v1.0.10/ dis t/js/n gal ertify.js"></script>
bower
bower install --save alertifyjs
npm
npm install --save alertifyjs
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;
};
网站地址 : http://fabien-d.github.com/alertify.js/
GitHub: https://github.com/fabien-d/alertify.js
网站描述: jQuery酷炫的各种消息 提示 插件
alertify.js官方网站
官方网站: http://fabien-d.github.com/alertify.js/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。