/**
* 警告
* @param {String}消息内容
*/
artDialog.alert = function (content, callback) {
return artDialog({
id: 'Alert',
icon: 'warning',
fixed: true,
// lock: true,
width:250,
height:50,
content: content,
ok: true,
close: callback
});
};
/**
* 确认
* @param {String}消息内容
* @param {Function}确定button回调函数
* @param {Function}取消button回调函数
*/
artDialog.confirm = function (content, yes, no) {
return artDialog({
id: 'Confirm',
icon: 'question',
fixed: true,
// lock: true,
opacity: .1,
width:250,
height:50,
content: content,
ok: function (here) {
return yes.call(this, here);
},
cancel: function (here) {
return no && no.call(this, here);
}
});
};
/**
* 提问
* @param {String}提问内容
* @param {Function}回调函数. 接收參数:输入值
* @param {String}默认值
*/
artDialog.prompt = function (content, yes, value) {
value = value || '';
var input; return artDialog({
id: 'Prompt',
icon: 'question',
fixed: true,
// lock: true,
width:250,
height:50,
opacity: .1,
content: [
'<div style="margin-bottom:5px;font-size:12px">',
content,
'</div>',
'<div>',
'<input value="',
value,
'" style="width:18em;padding:6px 4px" />',
'</div>'
].join(''),
init: function () {
input = this.DOM.content.find('input')[0];
input.select();
input.focus();
},
ok: function (here) {
return yes && yes.call(this, input.value, here);
},
cancel: true
});
};
/**
* 短暂提示
* @param {String}提示内容
* @param {Number}显示时间 (默认1.5秒)
*/
artDialog.tips = function (content, time) {
return artDialog({
id: 'Tips',
title: false,
cancel: false,
fixed: true,
// lock: true,
width:250,
height:50
})
.content('<div style="padding: 0 1em;">' + content + '</div>')
.time(time || 1);
};
//右下角滑动通知
artDialog.notice = function (options) {
var opt = options || {},
api, aConfig, hide, wrap, top,
duration = 800; var config = {
id: 'Notice',
left: '100%',
top: '100%',
fixed: true,
drag: false,
width:250,
height:50,
resize: false,
follow: null,
lock: false,
init: function(here){
api = this;
aConfig = api.config;
wrap = api.DOM.wrap;
top = parseInt(wrap[0].style.top);
hide = top + wrap[0].offsetHeight; wrap.css('top', hide + 'px')
.animate({top: top + 'px'}, duration, function () {
opt.init && opt.init.call(api, here);
});
},
close: function(here){
wrap.animate({top: hide + 'px'}, duration, function () {
opt.close && opt.close.call(this, here);
aConfig.close = $.noop;
api.close();
}); return false;
}
}; for (var i in opt) {
if (config[i] === undefined) config[i] = opt[i];
}; return artDialog(config);
};
//调用范例:
art.dialog.alert('人品越来越不那么稳定了,请检查!'); art.dialog.confirm('你确定要删除这掉消息吗?', function () {
art.dialog.tips('运行确定操作');
}, function () {
art.dialog.tips('运行取消操作');
}); art.dialog.prompt('请输入图片网址', function (val) {
art.dialog.tips(val);
}, 'http://'); art.dialog.tips('数据正在提交..', 2);
//[more code..]
art.dialog.tips('成功。已经保存在server');

最新文章

  1. TDD在Unity3D游戏项目开发中的实践
  2. 如何快速掌握一款新的MCU? (转)
  3. AndFix热修复 —— 实战与源码解析
  4. C# 压缩与解压字符串(面试题)
  5. POJ 2421(prim)
  6. 【转】PowerShell入门(九):访问.Net程序集、COM和WMI
  7. [Android Pro] AndroidStudio导出jar包
  8. hdu----(2586)How far away ?(DFS/LCA/RMQ)
  9. 解决android模拟器太大,小屏幕无法完全显示的问题
  10. 【模板】【凸包】Graham_scan
  11. and的用法(&amp;)
  12. quartz笔记
  13. Android -- 带你从源码角度领悟Dagger2入门到放弃(二)
  14. SpringMVC中redirect跳转后如何保存Model中的数据?
  15. WPF TextBox 正则验证 大于等于0 小于等于1 的两位小数
  16. Python之推导式、生成器表达式
  17. pycharm的简介
  18. Lavarel - 模块间复用代码
  19. docker 部署springboot应用
  20. 多态概念,C++

热门文章

  1. yes---重复输出指定的字符串
  2. iotop---监控磁盘I/O 使用状况
  3. Win10+CUDA9.0+cuDNN7.2 下载 安装 配置
  4. ECNUOJ 2573 Hub Connection plan
  5. Spring-statemachine fork一个region后不能进入join状态的问题
  6. Hadoop RPC框架
  7. CAShapeLayer的简单介绍以及基本使用
  8. 深入理解maven及应用(一):生命周期和插件
  9. Visual Studio Code Setup
  10. 仿即刻app&quot;猜你喜欢&quot;切换控件