复制代码代码如下所示:
/ ************************************自动适应流行********************************* 图片/
无功autoimg =功能(ARGCS){ / *调整图片的大小、比例缩放ARGCS { } = > 'maxheight的最大高度、最大宽度ARGCS { 'maxwidth} = >,高度'width ARGCS {'} = { } >宽度ARGCS 'height= >图片,图片。
无功_maxheight =;
无功_maxwidth =;
无功_newsize = { };

如果(ARGCS { 'maxheight ' }){
_maxheight = ARGCS { 'maxheight};
}
如果(ARGCS { 'maxwidth ' }){
_maxwidth = ARGCS { 'maxwidth};
}
如果(!ARGCS { 'height ' }){
把新的错误('height不指定的);
}
如果(!ARGCS { 'width ' }){
把新的错误('width不指定的);
}
如果(ARGCS { 'height'} { } | > ARGCS 'width| ARGCS { 'height} = = ARGCS { 'width ' }){不少于形势的宽度 / /高度
如果(ARGCS { 'height} > = _maxheight){
_newsize { } = _maxheight 'height;
_newsize { 'width} =(_maxheight / ARGCS { 'height ' })* ARGCS { 'width};
其他{ }
_newsize { } = { 'width ARGCS 'width''};
_newsize { } = { 'height ARGCS 'height''};
}
返回_newsize;
}
如果(ARGCS { 'width} > ARGCS { 'height ' }){ / /宽度大于高度的
如果(ARGCS { 'width} > = _maxwidth){
_newsize { } = _maxwidth 'width;
_newsize { 'height} =(_maxwidth / ARGCS { 'width ' })* ARGCS { 'height};
其他{ }
_newsize { } = { 'width ARGCS 'width''};
_newsize { } = { 'height ARGCS 'height''};
}
返回_newsize;
}
}

无功imgbox =功能(imgsrc){
无功winimg =新popbox({ / /图片流行
身份:'imgbox,
背景:# a3c90e,
宽度:906,
MoveHandle:假,
closebutton:假,
高度:汽车,
时报:250,
锁定:真的,
内容,
阴影:真的,
位置:'center,
displaycallback:函数(){
$('body)。追加('');
$('img { ID =加载})。Css('z-index ',110000)。Css({位置:绝对的,左:$(窗口),ScrollLeft()+($(窗口),Width())/ 2($(窗口)(())()),(())(())(())+(($)(())(())(($))(})}。
/ ************图片预加载,重新调整窗口的大小和位置************** /
VaR img =新的图像();
无功_imgwidth = 0;
无功_imgheight = 0;
img src= imgsrc; / /添加img对象地址
/ / console.log(imgsrc);
的加载*************************** / / *************************完成后。
IMG。指针函数(){
$('img { ID =加载})删除();
_imgwidth = img.width;
_imgheight = img.height;
VaR ARGCS = { };
无功winwidth = $(窗口)Width();
{ } = 750 'maxheight ARGCS '; / /最大高度
{ } = 900 'maxwidth ARGCS '; / /最大宽度
ARGCS { } = _imgheight 'height;
ARGCS { } = _imgwidth 'width;
无功newwh = autoimg(ARGCS); / /缩略图图像的宽度和高度后。
/ ************图片预加载,重新调整窗口的大小和位置************ /
$(# + winimg。ID)。Css({宽度:newwh { 'width},身高:newwh { 'height},顶部:parseInt($(document)。ScrollTop())+ parseInt(($(窗口),Height()- newwh { 'height ' })。高度),和(())(())(())
$(# + winimg。ID)。Html(' ');
/ ************图片预加载,重新调整窗口的大小和位置************** /

$(# + winimg。ID + '_bg)。Css('cursor ','pointer)。Click(function(){())
WinImg.kill();
});
};
的加载*************************** / / *************************完成后。
},
undisplaycallback:函数(){

},
KillCallBack:函数(){
}
});
WinImg.dispaly();
}

PopBox密码
复制代码代码如下所示:
如果使用移动函数,请导入jQuery移动UI组件
无功popbox =功能(设置){ / /窗口功能设置= { }
/ /警报(typeof设置'width{ });
/ /警报(设置'displaycallback{ });
私有变量***************************** / / ************************
默认值***************** / / *******************
无功_shadow = true; / /如果有真/假面具
无功_closebutton = false; / / /关闭按钮错误的DOM元素
无功_killbutton = false; / / /假杀按钮的DOM元素
Var _moveHandle=false; / / drag handle false/dom elements
无功_width = 650; / /宽,
无功_bgcolor =# FFF '; / /背景风格
无功_height =汽车; / /高
无功_content =内容; / /内容
无功_position = 'center '; / * topcenter,右上,左上角,中心,bottomleft,下bottomcenter * /
无功_lock = true; / /锁定
无功_times = 500; / /显示、隐藏时间
无功_displaycallback =函数(){ / /显示回调函数
警报(显示器);
}
无功_undisplaycallback =函数(){ / / undispaly回调函数
警报('undisplay);
}
_beforekillcallback =函数(){ var
警报('beforekill);
调用前的回调函数
无功_killcallback =函数(){ / /杀回调函数
警报(杀);
}
默认值***************** / / *******************
如果设置'closebutton({ }!=未定义的){
/ /警报(影子);
_closebutton =设置'closebutton'} {;
}
如果设置'killbutton({ }!=未定义的){
/ /警报(影子);
_killbutton =设置'killbutton'} {;
}
如果设置'movehandle({ }!=未定义的){
/ /警报(影子);
_movehandle =设置'movehandle'} {;
}
到设定值******************** / / ******************
/ *设置{影子}!= '设置{影子}=定义* /!
如果(设置{影子}!=未定义的){
/ /警报(影子);
_shadow =设置{影子};
}
如果设置'bgcolor({ }!=未定义的){
/ /警报(影子);
_bgcolor =设置'bgcolor'} {;
}
如果设置'width({ }!=未定义的){
_width =设置'width'} {;
}
如果设置'height({ }!=未定义的){
_height =设置'height'} {;
}
如果(设置{ 'content' }!=未定义的){
_content =设置{ 'content' };
}
如果(设置下{ }!=未定义的){
_position =设置下{ };
}
如果设置'times({ }!=未定义的){
_times =设置'times'} {;
}
如果(设置锁定{ }!=未定义的){
_lock =设置锁定{ };
}
如果设置'displaycallback({ }!=未定义的){
/ /警报();
_displayCallBack=settings{'displayCallBack'};
}
如果设置'undisplaycallback({ }!=未定义的){
_undisplaycallback =设置'undisplaycallback'} {;
}
如果设置'beforekillcallback({ }!=未定义的){
_beforekillcallback =设置'beforekillcallback'} {;
}
如果设置'killcallback({ }!=未定义的){
_killcallback =设置'killcallback'} {;
}

/ /警报(设置{影子});
/ /警报(_shadow);
私有变量****************************** / / ************************



这样的内部变量******************** / / *********************
无功_this =这;
无功_basezindex = 10000;
无功_domwidth = $(document)的Width();
无功_domheight = $(document)的Height();
这样的内部变量******************* / / ********************


这种 / ********************私有函数********************** /
无功_getzindex =功能(z-index ->){ / *含ID popBox DOM赢得第一遍历网页的DIV元素,找到号码,然后窗口背景的Z = +当前基数+ 1,Z = +电流炸弹箱数+ 2 * /
_len = $(var 'body)。儿童('div的长度);
无功_countdiv = 0;
_divobj = $(var 'body)孩子('div);
无功_reg = / / ^ popbox_; / /正则表达式
对于(var i = 0;i < _len;i++){
如果(_reg.test(_divobj.eq(我)。Attr('id'))){
_countdiv + = 1;
}
}
返回_countdiv; / /返回现有的弹箱数
}
无功_getwinzindex =函数(Z){ / /弹出
无功_winzindex = _basezindex + _getzindex()+ 2;
返回_winzindex;
}
无功_gewinbgzindex =函数(Z){ / /得到流行的背景
无功_winbgzindex = _basezindex + _getzindex()+ 1;
返回_winbgzindex;
}
Var(_renderbg =功能){ / /渲染背景
无功_winbgzindex = _gewinbgzindex();
警报($(文档))Height());
$('body)。追加(' '); / /插入身体半透明的背景
$(# + _this。ID + '_bg)。AddClass('popbox_bg)。Css({身高:_domheight,宽度:_domwidth,混浊:0 })。Css('z-index ',_winbgzindex)FadeTo(_times,0.7);
}
Var(_creatwin =功能){ / /创建一个表单
$('body)。追加('');
_rendercontent(_content); / /主渲染窗口
(_initwin); / /初始化形式
}
Var(_initwin =功能){ / /形式的初始化
无功_winzindex = _getwinzindex();
无功_transheight = 0;
如果(_height = =汽车){
_transheight =汽车;
其他{ }
_transheight = parseInt(_height)+ 'px;
}
$(# + _this。ID)。Css({宽度:parseInt(_width)+ 'px,身高:_transheight,位置:'absolute,旋光性:1、背景:_bgcolor })。Css('z-index,CSS)。
如果(_lock = = false){
如果(_movehandle = = = = = =false_movehandle undefined_movehandle!啊!{
$(# + _this。ID)。儿童(_movehandle)。Css('cursor ','move);
/ /警报(_movehandle);
/ /警报($(' # + _this。ID)。儿童(_movehandle)。Html());
}
}
(_locationwin) / /形式;定位
}
Var(_locationwin =功能){ / *形成topcenter,右上,左上角,centerleft,中心Centerright,bottomleft,bottomcenter,下* /
无功_windowheight = parseInt($(窗口),Height());
无功_windowwidth = parseInt($(窗口),Width());
/ /警报(_windowwidth + _height);
无功_left =(_windowwidth-parseint(_width)) / 2;
无功_top = parseInt($(document)(。scrollTop)(+ parseInt)($(窗口),高度(高度)$(' # + _this。ID)( / 2)));
$(# + _this。ID)。Css({顶:_top + 'px,左:_left + 'px});
}
无功_rendercontent =功能(内容){ / /显示主窗口
$(# + _this。ID)添加(内容);
}
Var(bindevent =功能){ / /绑定事件
如果(_this.status!= =杀_this.status!= = 'init){
如果(_closebutton = = = = = = undefined_closebutton '_closebutton假!!!){
$(# + _this。ID ++ _closebutton)。Css('cursor ','pointer)。活(点击功能(e){)
_this.undisplay();
});
如果设置/关闭(关闭)按钮
如果(_killbutton = = = = = = undefined_killbutton '_killbutton假!!!){
$(# + _this。ID ++ _killbutton)。Css('cursor ','pointer)。活(点击功能(e){)
_this.kill();
});
如果设置为杀(杀)按钮
}
如果(_lock = = false){
$(# + _this。ID)。Draggable({取消:});
}
}
这种 / *********************私有函数***************** /


这种公共职能****************** / / **********************
这个状态= 'init '; / /当前状态的初始化->初始化状态,显示>显示状态,undisplay -> undisplay状态,杀杀状态>
这个id;
无功_id =设置{ 'id' };
如果(_id = =| |(typeof _id){ = =未定义)
把新的错误(ID不能为空);
其他{ }
这个ID = 'popbox_ + _id;
}
如果该状态为init,或为呈现页面而被杀死,则此函数
/ /警报(_this。状态);
如果(_this。状态= = 'init| | _this状态= =杀。){
(_creatwin); / /创建一个表单
/ / $(' # + _this。ID)。Css('height ',_domheight);
如果(_shadow = = true){ / /渲染遮罩
/ *警报(_shadow);* /
_renderbg();
}
_this状态的显示器;
_displaycallback();
其他{ }
$(# + _this。ID)。FadeIn(_times);
如果(_shadow = = true){
$(# + _this。ID + '_bg)。FadeIn(_times);
}
_this状态的显示器;
}
/ /警报(typeof _displaycallback);
/ /警报(_this。状态);
BindEvent();
}
(此杀=功能)完全删除
/ /警报(_this。状态);
/ /警报(_this。状态);
如果(_this状态= =杀。| | _this。状态= = 'init){
/ /警报(_this。状态);
把新的错误(非法操作,目前的状态不允许杀死);
}
如果(_beforekillcallback!=未定义的){
_beforekillcallback();
}
$(# + _this。ID)删除();
如果(_shadow = = true){
$(# + _this。ID + '_bg)删除();
}
_this状态=杀;
如果(_killcallback!=未定义的){
_killcallback();
}
}
(这个。undisplay =功能){ / /隐藏功能
如果(_this。状态= = 'init| | _this状态= =杀。){
把新的错误(非法操作,目前的状态不允许undisplay);
}
如果(_undisplaycallback!=未定义的){
_undisplaycallback();
}
$(# + _this。ID)。FadeOut(_times);
$(# + _this。ID + '_bg)。FadeOut(_times);
_this状态= 'undisplay;
}
这种公共职能****************** / / **********************


} / / popbox网页窗口

无功errorbox =功能(errormsg){
/ /警报(typeof errorbox);
/ /警报(errorbox。长度);
无功errorobj =新popbox({
身份:'errorobj,
背景:# FFF,
宽度:300,
MoveHandle:假,
closebutton:假,
高度:汽车,
时报:200,
锁定:真的,
内容:$(' # errorboxcontent)。Html(),
阴影:真的,
位置:'center,
displaycallback:函数(){
$(# + errorobj。ID)。找到('到')Html();
$(# + errorobj。ID)。找到('到'),Html(errormsg);
$(# + errorobj。ID)。找到('。errorconfirm输入)。Click(function(){)
/ /警报();
ErrorObj.kill();
});
},
undisplaycallback:函数(){
把新的错误(错误无法关闭,只杀'); / /错误的方法只能杀死,无法关闭
},
KillCallBack:函数(){
/ / errorbox = null;
}
});
ErrorObj.dispaly();
} / /错误弹出窗口