artdialog对话框 三种样式 网址:http://www.planeart.cn/demo/artDialog/_doc/labs.html
摇头效果
类似与wordpress登录失败后登录框可爱的左右晃动效果
// 2011-07-17 更新
artDialog.fn.shake = function (){
var style = this.DOM.wrap[0].style,
p = [4, 8, 4, 0, -4, -8, -4, 0],
fx = function () {
style.marginLeft = p.shift() + 'px';
if (p.length <= 0) {
style.marginLeft = 0;
clearInterval(timerId);
};
};
p = p.concat(p.concat(p));
timerId = setInterval(fx, 13);
return this;
};
调用示例:
var dialog = art.dialog({
content: '<p>"己所不欲"下一句是?</p>'
+ '<input id="demo-labs-input" style="width:15em; padding:4px" />',
fixed: true,
id: 'Fm7',
icon: 'question',
okVal: '回答',
ok: function () {
var input = document.getElementById('demo-labs-input');
if (input.value !== '\u52ff\u65bd\u4e8e\u4eba') {
this.shake && this.shake();// 调用抖动接口
input.select();
input.focus();
return false;
} else {
art.dialog({
content: '恭喜你,回答正确!',
icon: 'succeed',
fixed: true,
lock: true,
time: 1.5
});
};
},
cancel: true
});
dialog.shake && dialog.shake();// 调用抖动接口
右下角滑动通知
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,
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.notice({
title: '万象网管',
width: 220,// 必须指定一个像素宽度值或者百分比,否则浏览器窗口改变可能导致artDialog收缩
content: '尊敬的顾客朋友,您IQ卡余额不足10元,请及时充值',
icon: 'face-sad',
time: 5
});
简单交互对话框
注意:artDialog iframeTools扩展已经包含这些扩展了
/**
* 警告
* @param {String} 消息内容
*/
artDialog.alert = function (content) {
return artDialog({
id: 'Alert',
icon: 'warning',
fixed: true,
lock: true,
content: content,
ok: true
});
};
/**
* 确认
* @param {String} 消息内容
* @param {Function} 确定按钮回调函数
* @param {Function} 取消按钮回调函数
*/
artDialog.confirm = function (content, yes, no) {
return artDialog({
id: 'Confirm',
icon: 'question',
fixed: true,
lock: true,
opacity: .1,
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,
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: false
})
.content('<div style="padding: 0 1em;">' + content + '</div>')
.time(time || 1.5);
};
调用范例:
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('成功!已经保存在服务器');
artdialog对话框 三种样式 网址:http://www.planeart.cn/demo/artDialog/_doc/labs.html的更多相关文章
- CSS选 择器 三种样式
一.CSS三种样式 代码 宽度 高度 实线 颜色 A内联样式是优先级最高的方式 px必须写 A:内联式 弊端:代码多很乱 <body> <div class="divc ...
- CSS的三种样式:内联式,嵌入式,外部式以及他们的优先级
从CSS 样式代码插入的形式来看基本能够分为下面3种:内联式.嵌入式和外部式三种. 1:内联式css样式表就是把css代码直接写在现有的HTML标签中,如以下代码: <p style=" ...
- css三种样式表写法
css三种样式表:1.内嵌样式表: <head> <style type="text/css"> 样式表写法 </style> < ...
- 转载:CSS的组成,三种样式(内联式,嵌入式,外部式),优先级
(仅供自己备份) 原文地址:http://blog.csdn.net/chq11106004389/article/details/50515717 CSS的组成 选择符/选择器+声明(属性+值) 选 ...
- HTML三种样式引入方式
HTML三种样式引入方式 HTML有三种样式引入方式:行内样式(inline Styles).嵌入式样式表(Embedded Style Sheets).外部样式表(External Style ...
- 《转载》CSS中的三种样式来源:创作人员、读者和用户代理
CSS中的样式一共有三种来源:创作人员.读者和用户代理,来源的不同会影响到样式的层叠方式,很多第一次学习CSS的朋友,对这三种来源可能会存在一些困惑,下面我写一下自己的理解,若有错误的地方还请指正. ...
- CSS三种样式
CSS 指层叠样式表 (Cascading Style Sheets): 1 内联样式:无法复用,在元素style内写 ,很少使用: 2 内部样式:在head元素内style属性内写,此样式可以被当前 ...
- 大家好,又是新的一天。今天给大家带来一些新的知识:选择器的种类和css的三种样式
今天我们为大家 选择了 六种 选择器: 1. 标签选择器 2.id选择器 3.class选择器 4.后代选择器 5.子代选择器 6.交集选择器 我们就举三个典型的例子:后代选择器,子代选择器和交集选择 ...
- CSS:概念和三种样式
简介: CSS(Cascading Style Sheets):层叠样式表,它用来控制HTML标签的样式,给网页结构穿衣服~ CSS的编写格式是键值对的形式 -> 格式:属性名 : 属性值: ...
随机推荐
- 3Dchart理解
想在Flex Chart中为图例设置3D效果,近几天查找了些资料,动手做了个DEMO供大家参考! DEMO演示地址http://xingjunli.webs.com/flash/flexChart ...
- 深入理解redis复制原理
原文:深入理解redis复制原理 1.复制过程 2.数据间的同步 3.全量复制 4.部分复制 5.心跳 6.异步复制 1.复制过程 从节点执行 slaveof 命令. 从节点只是保存了 slaveof ...
- C#基础之并行编程
并行编程从业务实现的角度可分为数据并行与任务并行,也就是要解决的问题是以数据为核心还是以要处理的事情为核心.基于任务的并行编程模型TPL(任务并行库)是从业务角度实现的并行模型,它以System.Th ...
- AngularJS中Directive指令系列
近段时间在研究Angular中的directive用法,打算写个系列.以官方文档为主.并参考诸多教程.加上自己的思考. 基本概念及用法 scope属性的使用. &, <, =, @ 符 ...
- Python接口测试实战5(下) - RESTful、Web Service及Mock Server
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- 理解学习Springboot(二)
一.关闭banner 如果不想看到任何的banner,可以将其关闭. 当然也可以自己自定义banner,http://patorjk.com/software/taag/#p=display& ...
- Scrapy爬去哪儿~上海一日游门票并存入MongoDB数据库
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZwAAAGGCAYAAABPDDfEAAAgAElEQVR4nOy9C3Rb1Z3/+z1Hkm35mT
- Unity Lighting - Choosing a Color Space 选择色彩空间(四)
Choosing a Color Space 选择色彩空间 In addition to selecting a rendering path, it’s important to choose ...
- IDEA 创建Spring Boot 项目
一.准备环境 配置Maven,打开设置页面File - Setting,快捷键Ctrl + Alt + S,找到Maven,默认是IDEA 自带的插件,User setting file 配置文件默认 ...
- redis主从配置+sentinel哨兵
redis主从配置+sentinel哨兵 1:编译环境准备 1.1环境确认 Redis是一个开源.支持网络.基于内存.键值对存储数据库,使用ANSI C编写.所以在搭建Redis服务器时需要C语言的编 ...