").attr("id","middleElement_bgDiv").css(
{
position:"absolute",
left:"0px",
top:"0px",
width:$(window).width()+"px",
height:Math.max($("body").height(),$(window).height())+"px",
filter:"Alpha(Opacity=40)",
opacity:"0.4",
backgroundColor:"#AAAAAA",
zIndex:"1000",
margin:"0px",
padding:"0px"
}
).appendTo("body");
}else{
$("#middleElement_bgDiv").show();
}
}
);
$("#windowClose").one("click",function(){
$("#windowContent").slideUp(600,function(){
$("#window").animate(
{
left:position.l,
top:position.t,
height:position.h,
width:position.w
},500,function(){
$(this).hide();
if($("#middleElement_bgDiv").get().length > 0){
$("#middleElement_bgDiv").hide();
}
$("#window").css(
{
left:winPosition.l,
top:winPosition.t,
height:winPosition.h,
width:winPosition.w
}
);
}
);
})
});
$("#windowTop").mousedown(function(){
$.alerts.Drag(
document.getElementById("window"),
{
e : event,
Drag : options.IsDrag
}
);
});
},
_createObject : function(){
$("
"+
"
"+
"
Window example
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"
").appendTo("body");
},
_getWindowPosition : function(options){
var wPosition = $.alerts._getPosition("#window");
var windowPosition = {};
windowPosition.t = parseInt($(window).height()/6) parseInt($(window).scrollTop()); ) $(window).scrollLeft())/2 - options.width/2;
windowPosition.h = options.height;
return windowPosition; },
_getPosition : function(o){
var top = $(o).offset().top;
var left = $(o).offset().left;高さ = $(o).height();
var width = $(o).width();
return {t:top,l:left,h:height,w:width}; >},
ドラッグ : function(obj,options){
var e = options.e ||
if(Drag == false)戻り値;
var x=parseInt(obj.style.left);
var x_=e.clientX-x; e.clientY-y;
if(document.addEventListener){
document.addEventListener('mousemove', inFmove, true);
document.addEventListener('mouseup', inFup, true);
} else if(document.attachEvent){
document.attachEvent('onmousemove', inFmove);
document.attachEvent('onmouseup', inFup);
}
inFstop(e);
inFabort(e);
関数 inFmove(e){
var evt;
if(!e)e=window.event;
obj.style.left=e.clientX-x_ 'px';
obj.style.top=e.clientY-y_ 'px';
inFstop(e);
}
関数 inFup(e){
var evt;
if(!e)e=window.event;
if(document.removeEventListener){
document.removeEventListener('mousemove', inFmove, true);
document.removeEventListener('mouseup', inFup, true);
} else if(document.detachEvent){
document.detachEvent('onmousemove', inFmove);
document.detachEvent('onmouseup', inFup);
}
inFstop(e);
}
function inFstop(e){
if(e.stopPropagation) return e.stopPropagation();
そうでない場合は e.cancelBubble=true を返します。
}
function inFabort(e){
if(e.preventDefault) return e.preventDefault();
else return e.returnValue=false;
}
}
}
JAlert = function(o,json){
$.alerts.alert(o,json);
};
})(jQuery);
代用代
复制代