📄 dw_posrel.js
字号:
/*
dw_posrel.js
contains posRel method for dynObj
adapted from cross-browser.com - Mike Foster
This code is from Dynamic Web Coding
at http://www.dyn-web.com/
See Terms of Use at http://www.dyn-web.com/bus/terms.html
Permission granted to use this code
as long as this entire notice is included.
*/
// position layer in window or containing layer
dynObj.prototype.posRel = function(loc,mar,container) {
if (!container) {
cWd = getWinWidth();
cHt = getWinHeight();
} else {
cWd = container.width;
cHt = container.height;
}
switch (loc) {
case "nw" :
x = mar; y = mar;
break;
case "n":
x = Math.round((cWd-this.width)/2);
y = mar;
break;
case "ne" :
x = cWd-this.width-mar;
y = mar;
break;
case "w" :
x = mar;
y = Math.round((cHt-this.height)/2);
break;
case "c" :
x = Math.round((cWd-this.width)/2);
y = Math.round((cHt-this.height)/2);
break;
case "e" :
x = cWd-this.width-mar;
y = Math.round((cHt-this.height)/2);
break;
case "sw" :
x = mar;
y = cHt-this.height-mar;
break;
case "s" :
x = Math.round((cWd-this.width)/2);
y = cHt-this.height-mar;
break;
case "se" :
x = cWd-this.width-mar;
y = cHt-this.height-mar;
break;
default :
alert("Wrong position chosen!")
break;
}
this.leftPos = x;
this.topPos = y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -