Js代碼
2.
傳入HTMLElement
備注:1、元素不是復制而是完整移動到對話框中,所以原有的事件與屬性都將會保留 2、如果隱藏元素被傳入到對話框,會設置display:block屬性顯示該元素 3、對話框關閉的時候元素將恢復到原來在頁面的位置,style display屬性也將恢復
********************************************************************************************
只前這個東東也是朋友完我的,后來經剛剛一位朋友提醒,我google一下,現在完整的教程都在里面,所有包都在里面。
我也不好意思,現在補充下。呵呵,因為不算晚吧。
art.dialog({
content: document.getElementByIdx_x_x('demoCode_content_DOM'),
id: 'EF893L'
});
效果:把指定的div加載到這個彈框上
art.dialog({
title: 'hello world!'
});
效果:
備注:回調函數this指向擴展接口,如果返回false將阻止對話框關閉
art.dialog({
content: '如果定義了回調函數才會出現相應的按鈕',
ok: function () {
this.title('3秒后自動關閉').time(3);
return false;
},
cancelVal: '關閉',
cancel: true //為true等價於function(){}
});
art.dialog({
width: '100%',
height: '100%',
left: '0%',
top: '0%',
fixed: true,
resize: false,
drag: false
})
效果圖:
備注:1、元素不是復制而是完整移動到對話框中,所以原有的事件與屬性都將會保留 2、如果隱藏元素被傳入到對話框,會設置display:block屬性顯示該元素 3、對話框關閉的時候元素將恢復到原來在頁面的位置,style display屬性也將恢復
********************************************************************************************
只前這個東東也是朋友完我的,后來經剛剛一位朋友提醒,我google一下,現在完整的教程都在里面,所有包都在里面。
我也不好意思,現在補充下。呵呵,因為不算晚吧。
art.dialog({
content: document.getElementByIdx_x_x('demoCode_content_DOM'),
id: 'EF893L'
});
效果:把指定的div加載到這個彈框上
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3M5LnNpbmFpbWcuY24vbXc2OTAvNWZmOGUwYTB4ZDNlZjNhNjFiNjM4JjY5MA==.png)
JS代碼
標題 [title]
art.dialog({
title: 'hello world!'
});
效果:
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3MxMi5zaW5haW1nLmNuL213NjkwLzVmZjhlMGEweDdiOTdlY2JjZGU4YiY2OTA=.png)
Js代碼
確定取消按鈕 [ok & cancel]
備注:回調函數this指向擴展接口,如果返回false將阻止對話框關閉
art.dialog({
content: '如果定義了回調函數才會出現相應的按鈕',
ok: function () {
this.title('3秒后自動關閉').time(3);
return false;
},
cancelVal: '關閉',
cancel: true //為true等價於function(){}
});
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3MxNi5zaW5haW1nLmNuL213NjkwLzVmZjhlMGEweGQzZWY0MWJkN2MxZiY2OTA=.png)
Js代碼
創建一個全屏對話框
art.dialog({
width: '100%',
height: '100%',
left: '0%',
top: '0%',
fixed: true,
resize: false,
drag: false
})
效果圖:
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3MxNi5zaW5haW1nLmNuL213NjkwLzVmZjhlMGEweGQzZWY0OTBlZGE3ZiY2OTA=.png)
Js代碼
右下角滑動通知
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.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});
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3MxMy5zaW5haW1nLmNuL213NjkwLzVmZjhlMGEweGQzZWY1MTk4ZmQyYyY2OTA=.png)
Js代碼
跨域訪問
跨域訪問無法自適應大小,也無法進行父頁面與子頁面數據交換
art.dialog.open('http://www.connect.renren.com/igadget/renren/index.html',
{title: '人人網', width: 320, height: 400});
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3MzLnNpbmFpbWcuY24vbXc2OTAvNWZmOGUwYTB4ZDNlZjU2ZWE0ZDkyJjY5MA==.png)
Js代碼
加載googleMAP
art.dialog.open('googleMaps.html');
art.dialog.open('googleMaps.html');
效果圖:
![[IT]artDialog使用說明(彈窗API) [IT]artDialog使用說明(彈窗API)](/image/aHR0cDovL3M5LnNpbmFpbWcuY24vbXc2OTAvNWZmOGUwYTB4ZDNlZjVkMjVhYmM4JjY5MA==.png)
如何使用?
1.導入<script src="http://blog.163.com/penglie_520/blog/artDialog/artDialog.js?skin=default"></script>
2.加上
Js代碼
(function (config) {
config['lock'] = true;
config['fixed'] = true;
config['okVal'] = 'Ok';
config['cancelVal'] = 'Cancel';
// [more..]
})(art.dialog.defaults);//這個是用哪個主題有很多主題的你把名字打上就行啦
**********************這是googleMap的代碼Copy就行啦沒有問題有問題給我留言不懂就問只要你問我就說***********************************
Js代碼
<!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.getElementByIdx_x("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.getElementByIdx_x("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="http://blog.163.com/penglie_520/blog/' + url + '" />', padding: 0, width: 558, height: 360, lock: true});
return false;
}, focus: true})
.position('50%', 'goldenRatio');
document.getElementByIdx_x("map-search-sumbit").onclick = function () {
var input = document.getElementByIdx_x('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>
1.導入<script src="http://blog.163.com/penglie_520/blog/artDialog/artDialog.js?skin=default"></script>
2.加上
Js代碼
(function (config) {
config['lock'] = true;
config['fixed'] = true;
config['okVal'] = 'Ok';
config['cancelVal'] = 'Cancel';
// [more..]
})(art.dialog.defaults);//這個是用哪個主題有很多主題的你把名字打上就行啦
**********************這是googleMap的代碼Copy就行啦沒有問題有問題給我留言不懂就問只要你問我就說***********************************
Js代碼
<!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.getElementByIdx_x("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.getElementByIdx_x("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="http://blog.163.com/penglie_520/blog/' + url + '" />', padding: 0, width: 558, height: 360, lock: true});
return false;
}, focus: true})
.position('50%', 'goldenRatio');
document.getElementByIdx_x("map-search-sumbit").onclick = function () {
var input = document.getElementByIdx_x('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>