`
jsczxy2
  • 浏览: 1258049 次
  • 性别: Icon_minigender_1
  • 来自: 常州
文章分类
社区版块
存档分类
最新评论

[转]很牛的js弹出层-artDialog4.1.2

阅读更多

转自:http://www.iteye.com/topic/1117866

 

Sharpleo 写道
先让我们看看他提供的几种皮肤吧











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

效果:

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

********************************************************************************************
只前这个东东也是朋友完我的,后来经刚刚一位朋友提醒,我google一下,现在完整的教程都在里面,所有包都在里面。
我也不好意思,现在补充下。呵呵,因为不算晚吧。
art.dialog({
    content: document.getElementById('demoCode_content_DOM'),
    id: 'EF893L'
});

效果:把指定的div加载到这个弹框上

标题 [title]
art.dialog({
    title: 'hello world!'
});

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

效果:
自定义按钮 [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: '关闭我'
        }
    ]
});

效果:
定时关闭的消息 [time]
art.dialog({
    time: 2,
    content: '两秒后关闭'
});

效果:2秒后关闭这个只有看才看得到效果截图不行

定义消息图标 [icon]
请查看skin/icons目录下的图标
art.dialog({
    icon: 'succeed',
    content: '我可以定义消息图标哦'
});

图标有好几种就拿这个success效果图给大家看下:

锁屏 [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
});

效果:这是个锁屏的你可自定义背景颜色和图标等等一些属性

自定义坐标 [left & top]
art.dialog({
    left: 100,
    top: '60%',
    content: '我改变坐标了'
});

效果:自定义坐标 传X,Y就可以啦

创建一个全屏对话框
art.dialog({
    width: '100%',
    height: '100%',
    left: '0%',
    top: '0%',
    fixed: true,
    resize: false,
    drag: false
})


右下角滑动通知
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秒后自动消失

跨域访问
跨域访问无法自适应大小,也无法进行父页面与子页面数据交换
art.dialog.open('http://www.connect.renren.com/igadget/renren/index.html',
    {title: '人人网', width: 320, height: 400});

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

效果图



对啦忘记说啦要换皮肤只要换上下面图片上的css文件名就可以啦



****************************************************************
功能太多啦我手软啦 不写啦  直接说怎么用吧
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祝你好运

 

 

分享到:
评论
2 楼 shangchuang521 2014-11-18  
拷贝googlemap的代码,看效果时,报google未定义,这是什么原因,谢谢啊
1 楼 masuweng 2012-04-07  
不错的东西,很实用!

相关推荐

    poi-ooxml-4.1.2-API文档-中文版.zip

    赠送jar包:poi-ooxml-4.1.2.jar; 赠送原API文档:poi-ooxml-4.1.2-javadoc.jar; 赠送源代码:poi-ooxml-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-ooxml-4.1.2.pom; 包含翻译后的API文档:poi-ooxml-...

    poi-ooxml-4.1.2-API文档-中英对照版.zip

    赠送jar包:poi-ooxml-4.1.2.jar; 赠送原API文档:poi-ooxml-4.1.2-javadoc.jar; 赠送源代码:poi-ooxml-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-ooxml-4.1.2.pom; 包含翻译后的API文档:poi-ooxml-...

    poi-4.1.2完整jar包

    poi-4.1.2完整jar包。 poi-4.1.2.jar poi-examples-4.1.2.jar poi-excelant-4.1.2.jar poi-ooxml-4.1.2.jar poi-ooxml-schemas-4.1.2.jar poi-scratchpad-4.1.2.jar

    poi-scratchpad-4.1.2-API文档-中英对照版.zip

    赠送jar包:poi-scratchpad-4.1.2.jar; 赠送原API文档:poi-scratchpad-4.1.2-javadoc.jar; 赠送源代码:poi-scratchpad-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-scratchpad-4.1.2.pom; 包含翻译后的API...

    poi-bin-4.1.2-20200217相关jar包

    当前B/S模式已成为应用开发的主流,而在企业办公系统中,常常有客户这样子要求:你要把我们的报表直接用Excel打开(电信系统、银行系统)。或者是:我们已经习惯用...本poi-4.1.2.jar、poi-ooxml-schemas-4.1.2.jar、等

    poi-scratchpad-4.1.2-API文档-中文版.zip

    赠送jar包:poi-scratchpad-4.1.2.jar; 赠送原API文档:poi-scratchpad-4.1.2-javadoc.jar; 赠送源代码:poi-scratchpad-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-scratchpad-4.1.2.pom; 包含翻译后的API...

    opencv_python-4.1.2-cp35-cp35m-win_amd64 python包

    opencv_python-4.1.2-cp35-cp35m-win_amd64 python包 opencv_python-4.1.2-cp35-cp35m-win_amd64 python包 opencv_python-4.1.2-cp35-cp35m-win_amd64 python包 opencv_python-4.1.2-cp35-cp35m-win_amd64 python包 ...

    poi-4.1.2-API文档-中英对照版.zip

    赠送jar包:poi-4.1.2.jar; 赠送原API文档:poi-4.1.2-javadoc.jar; 赠送源代码:poi-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-4.1.2.pom; 包含翻译后的API文档:poi-4.1.2-javadoc-API文档-中文(简体)-...

    gcc-4.1.2-46安装包rpm(x86-64)含依赖

    rpm -ivh libgcc-4.1.2-46.el5.i386.rpm --force --nodeps rpm -ivh glibc-2.5-42.i686.rpm --force --nodeps rpm -ivh cpp-4.1.2-46.el5.i386.rpm --force --nodeps rpm -ivh libgomp-4.4.0-6.el5.i386.rpm --force...

    免费vnc server:vnc-server-4.1.2-14.el5_6.6.i386.rpm

    已测试,免费vnc server:vnc-server-4.1.2-14.el5_6.6.i386.rpm

    poi-ooxml-4.1.2.jar中文文档.zip

    注:下文中的 *** 代表文件名中的版本号。 # 【poi-ooxml-***.jar中文文档.zip】 中包含: 中文文档:【poi-ooxml-***-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【poi-ooxml-***.jar下载地址(官方地址+...

    poi-bin-4.1.2.zip

    Apache POI小组很高兴宣布4.1.2版本。 此版本在XDDF中提供了更好的图表支持,Common SL / EMF模块中的各种渲染修复以及在XSLF中处理任意幻灯片索引时的OOM修复(+对SparseBitSet 1.2的新依赖)。 几个依赖项也已更新...

    opencv_python-4.1.2+contrib-cp37-cp37m-win_amd64.whl

    opencv_python-4.1.2+contrib-cp37-cp37m-win_amd64.whl opencv-python4.1.2离线安装包

    poi-4.1.2-API文档-中文版.zip

    赠送jar包:poi-4.1.2.jar; 赠送原API文档:poi-4.1.2-javadoc.jar; 赠送源代码:poi-4.1.2-sources.jar; 赠送Maven依赖信息文件:poi-4.1.2.pom; 包含翻译后的API文档:poi-4.1.2-javadoc-API文档-中文(简体)版...

    arm-linux-gcc4.1.2

    arm-linux-gcc4.1.2

    免费的VNC安装包,vnc-server-4.1.2-14.el5_6.6.x86_64

    vnc-server-4.1.2-14.el5_6.6.x86_64;免费VNC工具

    Android-Openfire-Smack4.1.2 (Android Studio)

    Android-Openfire-Smack4.1.2 使用入门

    apache-activemq-4.1.2

    apache-activemq-4.1.2服务器

    gcc-c++ 4.1.2-51版本

    好不容易找到了这个版本,分享先。。。。。。。

    spring-framework-4.1.2.RELEASE-docs

    spring-framework-4.1.2.RELEASE-docs.zip 中 主要包含两项 一、spring-framework-4.1.2.RELEASE-javadoc-api 1. 即——API 2. 可阅读的格式为 "多页html" 二、spring-framework-4.1.2.RELEASE-reference 1. 即...

Global site tag (gtag.js) - Google Analytics