国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

基于Jquery的開發個代陰影的對話框效果代碼

2019-11-20 23:44:49
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

<script type="text/javascript" src="http://img.zzl.com/script/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function() {
$("#open").click(function() {
openDialog(a1); //調用,直接寫上DIV的ID即可
});
});
var openDialog = function(o) {
var dialog = new zzlDialog(o);
dialog.open();
}
var zzlDialog = function(o) {
this.init = function() {
/* 對話框初始化 */
var XBox = '/
<div id="mask"/>/
<div id="wai">/
</div>/
<div id="nie">/
<table>/
<thead>/
<tr>/
<td>/
陰影彈出框/
</td>/
<td>/
</td>/
</tr>/
</thead>/
<tbody>/
<tr>/
<td colspan="2">' + $(o).html() + '/
</td>/
</tr>/
</tbody>/
</table>/
</div>/
';
$(document.body).append(XBox);
};

this.cssInit = function() {
/* css初始化 */
$("#wai").css({ "padding": "10px", "background": "#000", "filter": "Alpha(Opacity='50')", "position": "absolute" });
$("#nie").css({ "position": "absolute", "z-index": "1000" });
$("#nie>table").css({ "border": "1px solid rgb(55,119,188)", "border-collapse": "collapse", "background": "#fff" });
$("#nie>table>thead>tr").css({ "background": "rgb(0,94,172)", "color": "#fff", "height": "30px", "font-size": "14px", "font-weight": "bold" });
$("#nie>table").find("td").css({ "padding": "5"});
/* 內部主體定位 */
$("#nie").css({ "top": "50px" });
$("#nie").css({ "left": "50px" });
/* 關閉按鈕 */
var $close = $("#nie>table>thead").find("td").next("td");
$close.html("<span>關閉</span>");
$close.css({ "text-align": "right", "padding-right": "5px" });
$close.find("span").css({ "font-weight": "normal", "cursor": "hand" });
$close.find("span").click(function() { new zzlDialog().closes(); });
/* 外部陰影添加 ,及位置和大小由內部內容來控制 */
$("#wai").css({ "width": ($("#nie>table").width() + 16) + "px", "height": ($("#nie>table").height() + 16) + "px" });
$("#wai").css({ "top": $("#nie").position().top - 8 + "px", "left": $("#nie").position().left - 8 + "px", "z-index": $("#nie").css("z-index") });
// $("#wai").corner("5px"); //圓角
};
this.open = function() {
this.init();
this.cssInit();
this.shadow();
};
this.shadow = function() {
this.event_b_show();
if (window.attachEvent) {
window.attachEvent('onresize', this.event_b);
window.attachEvent('onscroll', this.event_b);
}
else {
window.addEventListener('resize', this.event_b, false);
window.addEventListener('scroll', this.event_b, false);
}
};

this.event_b = function() {
var oShadow = $('#mask');
if (oShadow.css("display") != "none") {
if (this.event_b_show) {
this.event_b_show();
}
}
};
this.closes = function() {
var oShadow = $('#mask');
oShadow.css({ 'display': 'none' });
$("#wai").remove();
$("#nie").remove();
};
this.event_b_show = function() {
var oShadow = $('#mask');
oShadow.css({ 'position': 'absolute', 'display': '', 'opacity': '0.1', 'filter': 'alpha(opacity=10)', 'background': '#000' });
var sClientWidth = parent ? parent.document.body.offsetWidth : document.body.offsetWidth;
var sClientHeight = parent ? parent.document.body.offsetHeight : document.body.offsetHeight;
var sScrollTop = parent ? (parent.document.body.scrollTop + parent.document.documentElement.scrollTop) : (document.body.scrollTop + document.documentElement.scrollTop);
oShadow.css({ 'top': '0px', 'left': '0px', 'width': sClientWidth + "px", 'height': (sClientHeight + sScrollTop) + "px" });
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永济市| 繁昌县| 伊宁市| 洛川县| 沂南县| 上杭县| 临泉县| 女性| 云和县| 锡林浩特市| 连州市| 社会| 大埔区| 清河县| 剑川县| 邻水| 安远县| 九龙县| 武平县| 青神县| 永春县| 通海县| 新疆| 五大连池市| 彰化市| 穆棱市| 横峰县| 商河县| 交口县| 临洮县| 甘孜| 汽车| 同德县| 千阳县| 分宜县| 涿鹿县| 全椒县| 信阳市| 巴塘县| 安仁县| 子长县|