(分享)一款很漂亮的弹框

el/2024/7/17 20:51:39
[img][/img]先让我们看看他提供的几种皮肤吧
[img]http://dl.iteye.com/upload/attachment/588167/ab2ce0ce-4568-3634-a02b-d62ffc6616e9.png[/img]
[img]http://dl.iteye.com/upload/attachment/588169/caa29641-9818-3a2b-aaf7-c4289c427fe9.png[/img]
[img]http://dl.iteye.com/upload/attachment/588171/c4e73165-6d64-3d5f-b314-bfd3482051dc.png[/img]
[img]http://dl.iteye.com/upload/attachment/588173/a9f4e0ec-8990-30aa-91c0-13748611ee36.png[/img]
[img]http://dl.iteye.com/upload/attachment/588175/3e890b49-28e6-3f2d-aa45-cdc718116dc6.png[/img]
[img]http://dl.iteye.com/upload/attachment/588190/c3a74b87-fa46-3cf0-bed6-799bc5f967c5.png[/img]
[img]http://dl.iteye.com/upload/attachment/588179/0e54bad9-7734-3165-96d9-f22c1ab29013.png[/img]
[img]http://dl.iteye.com/upload/attachment/588182/0e8a267f-6039-392d-a785-bd350c957b42.png[/img]
[img]http://dl.iteye.com/upload/attachment/588186/c6ab286c-735b-33fe-b456-63572b15e30f.png[/img]
[img]http://dl.iteye.com/upload/attachment/588188/010cbcef-ad86-312e-8425-4a656ff41532.png[/img]

功能:

1. 传入字符串
art.dialog({
content: '我支持HTML'
});

效果:[img]http://dl.iteye.com/upload/attachment/588199/28284a10-cd4a-3adc-b6b1-033885ff508a.png[/img]

2. 传入HTMLElement
备注:1、元素不是复制而是完整移动到对话框中,所以原有的事件与属性都将会保留 2、如果隐藏元素被传入到对话框,会设置display:block属性显示该元素 3、对话框关闭的时候元素将恢复到原来在页面的位置,style display属性也将恢复
art.dialog({
content: document.getElementById('demoCode_content_DOM'),
id: 'EF893L'
});

效果:把指定的div加载到这个弹框上
[img]http://dl.iteye.com/upload/attachment/588201/6761736e-85c3-3e3b-a589-7137c2bd8d53.png[/img]
标题 [title]
art.dialog({
title: 'hello world!'
});

效果:[img]http://dl.iteye.com/upload/attachment/588203/b1b5a875-b137-3096-90de-1caff7a37008.png[/img]
确定取消按钮 [ok & cancel]
备注:回调函数this指向扩展接口,如果返回false将阻止对话框关闭
art.dialog({
content: '如果定义了回调函数才会出现相应的按钮',
ok: function () {
this.title('3秒后自动关闭').time(3);
return false;
},
cancelVal: '关闭',
cancel: true //为true等价于function(){}
});

效果:[img]http://dl.iteye.com/upload/attachment/588206/bd66465c-ce81-3360-9769-5ad48555dc0c.png[/img]
自定义按钮 [button]
备注:回调函数this指向扩展接口,如果返回false将阻止对话框关闭;button参数对应的扩展方法名称也是"button"
art.dialog({
id: 'testID',
content: 'hello world!',
button: [
{
name: '同意',
callback: function () {
this.content('你同意了').time(2);
return false;
},
focus: true
},
{
name: '不同意',
callback: function () {
alert('你不同意')
}
},
{
name: '无效按钮',
disabled: true
},
{
name: '关闭我'
}
]
});

效果:[img]http://dl.iteye.com/upload/attachment/588208/cc636198-4f87-3001-9d28-ba278e531dd0.png[/img]
定时关闭的消息 [time]
art.dialog({
time: 2,
content: '两秒后关闭'
});

效果:2秒后关闭这个只有看才看得到效果截图不行
[img]http://dl.iteye.com/upload/attachment/588210/cf8d6665-4168-3b51-a7e4-8264ca570013.png[/img]
定义消息图标 [icon]
请查看skin/icons目录下的图标
art.dialog({
icon: 'succeed',
content: '我可以定义消息图标哦'
});

图标有好几种就拿这个success效果图给大家看下:
[img]http://dl.iteye.com/upload/attachment/588212/39b693fa-dfa6-37d7-b03a-c66d08ba9b50.png[/img]
锁屏 [lock & background & opacity]
art.dialog({
lock: true,
background: '#600', // 背景色
opacity: 0.87, // 透明度
content: '中断用户在对话框以外的交互,展示重要操作与消息',
icon: 'error',
ok: function () {
art.dialog({content: '再来一个锁屏', lock: true});
return false;
},
cancel: true
});

效果:这是个锁屏的你可自定义背景颜色和图标等等一些属性
[img]http://dl.iteye.com/upload/attachment/588214/ffdb742c-3b73-37b8-91dd-7f0dc0e51290.png[/img]
自定义坐标 [left & top]
art.dialog({
left: 100,
top: '60%',
content: '我改变坐标了'
});

效果:自定义坐标 传X,Y就可以啦
[img]http://dl.iteye.com/upload/attachment/588218/1956e78a-9d3f-3c43-8d8e-d0715d128a9a.png[/img]
创建一个全屏对话框
art.dialog({
width: '100%',
height: '100%',
left: '0%',
top: '0%',
fixed: true,
resize: false,
drag: false
})

[img]http://dl.iteye.com/upload/attachment/588220/1cf04aa0-6e55-32a9-966c-3d870a8e1351.png[/img]
右下角滑动通知
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
});

效果:模仿网吧右下角通知 带动画效果5秒后自动消失
[img]http://dl.iteye.com/upload/attachment/588225/5b718caf-1063-3ffc-8792-5306e33185b5.png[/img]
跨域访问
跨域访问无法自适应大小,也无法进行父页面与子页面数据交换
art.dialog.open('http://www.connect.renren.com/igadget/renren/index.html',
{title: '人人网', width: 320, height: 400});

效果:[img]http://dl.iteye.com/upload/attachment/588227/a2e867c9-a96a-3b16-9c52-6eef54408d4f.png[/img]

加载googleMAP
art.dialog.open('googleMaps.html');

效果图
[img]http://dl.iteye.com/upload/attachment/588229/0496db65-f3c2-3eb4-b635-6fef7b1b7695.png[/img]
[img]http://dl.iteye.com/upload/attachment/588232/218e28fc-b891-3370-98f9-53e2e6f90f1c.png[/img]

对啦忘记说啦要换皮肤只要换上下面图片上的css文件名就可以啦
[img]http://dl.iteye.com/upload/attachment/588234/1efee3aa-5d2e-3b90-8900-c169970eab09.png[/img]


****************************************************************
功能太多啦我手软啦 不写啦 直接说怎么用吧
1.导入<script src="artDialog/artDialog.js?skin=default"></script>
2.加上
(function (config) {
config['lock'] = true;
config['fixed'] = true;
config['okVal'] = 'Ok';
config['cancelVal'] = 'Cancel';
// [more..]
})(art.dialog.defaults);//这个是用哪个主题有很多主题的你把名字打上就行啦




**********************这是googleMap的代码Copy就行啦没有问题有问题给我留言不懂就问只要你问我就说***********************************

<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0; background-color: #FFF }
#map_canvas { height: 100% }
</style>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=zh_CN"></script>
<script>
var map, geocoder;
function initialize() {
var latlng = new google.maps.LatLng(39.904214, 116.407413);
var options = {
zoom: 11,
center: latlng,
disableDefaultUI: true,
panControl: true,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: false,
overviewMapControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), options);
geocoder = new google.maps.Geocoder();
geocoder.geocode({latLng: latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[3]) {
document.getElementById("map_address").value = results[3].formatted_address;
}
}
});

var dialog = art.dialog.open.api;
dialog.title('google mpas')
.size(558, 360)
.button({name: '截图', callback: function () {
var center = map.getCenter().lat() + ',' + map.getCenter().lng(),
zoom = map.getZoom(),
maptype = map.getMapTypeId(),
url = 'http://maps.googleapis.com/maps/api/staticmap';
url += '?center=' + encodeURIComponent(center);
url += '&zoom=' + encodeURIComponent(zoom);
url += '&size=558x360';
url += '&maptype=' + encodeURIComponent(maptype);
url += '&markers=' + encodeURIComponent(center);
url += '&language=zh_CN';
url += '&sensor=false';

art.dialog.through({title: false, content: '<img src="' + url + '" />', padding: 0, width: 558, height: 360, lock: true});

return false;
}, focus: true})
.position('50%', 'goldenRatio');

document.getElementById("map-search-sumbit").onclick = function () {
var input = document.getElementById('map_address');
search(input.value);
};
}
function search(address) {
if (!map) return;
geocoder.geocode({address : address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setZoom(11);
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Invalid address: " + address);
}
});
}
</script>
</head>
<body onLoad="initialize();" style="font: 12px/1.11 'Microsoft Yahei', Tahoma, Arial, Helvetica, STHeiti; _font-family:Tahoma,Arial,Helvetica,STHeiti; -o-font-family: Tahoma, Arial;">
<div style="width:100%; height:100%">
<table style="width:100%;height:100%;">
<tr>
<td style="height:38px"><div style="margin:5px;">地址: <input id="map_address" value="" style="width:200px; padding:4px;"> <button id="map-search-sumbit">搜 索</button></div></td>
</tr>
<tr>
<td style="height:100%"><div id="map_canvas" style="height:100%; margin:0 5px"></div></td>
</tr>
</table>
</div>
</body>
</html>


还有可以失现很多功能有些功能是我扩展的,改天再说吧,好累。有问题记得给我留言哦,js 和 css在附件里googlemap代码我粘贴出来啦记得COpy祝你好运

http://www.ngui.cc/el/5557649.html

相关文章

Fdeora 16 安装mysql

yum install mysql yum install mysql-server yum install mysql-devel chgrp -R mysql /var/lib/mysql chmod -R 770 /var/lib/mysql service mysqld start 修改root的密码 mysqladmin -u root password newpassword 更改密码 mysql -u root -p 登录数据库 mysql> DRO…

hibernateTemple 扩展分页

/** * 使用HQL语句进行分页查询操作 * offset 第一条记录的索引 * pageSize 每页需要显示的记录数 * return 当前页的所有记录 */ public List findByPage(final String hql, final int offset, final int pageSize) throws Exception { List list this.getHibernateTem…

dom4j 创建xml文件

/* * 创建XML文件 */ public void createEmptyXML(String fileName) throws Exception { // 使用DocumentHelper.createDocument方法建立一个文档实例 Document document DocumentHelper.createDocument(); // 使用addElement方法方法创建根元素 Element catalogElement…

spring 注解事务

<!-- from the file context.xml --><?xml version"1.0" encoding"UTF-8"?><beans xmlns"http://www.springframework.org/schema/beans" xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance" xmlns:aop&…

fedora 内核更新

在安装一 个新的fedora发行版本后,可以选择升级所有的软件,也可以只升级下fedora编译过的内核包,在测试完新的内核后,再把旧的内核包卸载掉,节约空 间。这里只探讨fedora的自动在线升级方式,没有使用手动的方式,也即意味着会自动搞定vmlinuz,initrd.img,system.map 等文…

jquery encoding

客户端&#xff1a; $.ajax({ url:${logStatisticByType}, data:{"ids":encodeURI(ids)}, type:"get", success:function(){alert("xxx");} }); 在服务端&#xff1a; String ids CommonManage.getParam("ids"); try { ids java.n…

El表达式得到list的长度

在jsp页面中不能通过${list.size}取列表长度&#xff0c;而是 <% taglib uri"http://java.sun.com/jsp/jstl/core" prefix"c"%> <% taglib prefix"fn" uri"http://java.sun.com/jsp/jstl/functions"%> list的长度是&…

jstl 格式化标签

需要引入格式化标签库 <% taglib prefix”fmt” uri”http://java.sun.com/jsp/jstl/fmt”%> 一&#xff0c;格式化日期 Value&#xff1a;表示的是日期 Type&#xff1a;表示的是日期显示的格式&#xff0c;date表示显示时间&#xff0c;time表示显示日期&#xff0c;bo…

Mssql未能加载文件或程序集“Microsoft.SqlServer.Sqm,

未能加载文件或程序集“Microsoft.SqlServer.Sqm, Version10.0.0.0, Cultureneutral, PublicKeyToken89845dcd8080cc91”或它的某一个依赖项。系统找不到指定的文件。 (SqlMgmt) ------------------------------ 程序位置: 在 Microsoft.SqlServer.Management.SqlMgmt.SqmHelp…

struts2 效验文件模板

struts2中的数据校验文件配置 <?xml version"1.0" encoding"UTF-8"?> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd&quo…