- 浏览: 314259 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
Jett:
...
Android的Activity一打开就出现讨嫌的软键盘,怎样将其关闭? -
nuannuan6818:
这也算是一种方法,不过感觉不可取,这样把图片的存储位置固定死了 ...
JSP 页面中用绝对路径显示图片 -
hhayyok:
xiexie
Eclipse jar打包详解 -
lixiplus:
写的好, 给力
JSP 页面中用绝对路径显示图片 -
叶落秋陌:
原来是把lib放在jar外面,帮了大忙~
Eclipse jar打包详解
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<br /><br /><br /><br />
<script>
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
function Each(list, fun){
for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
};
var $ = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}
Function.prototype.bind = function(object) {
var __method = this, args = Array.apply(null, arguments); args.shift();
return function() {
return __method.apply(object, args);
}
}
var OverLay = Class.create();
OverLay.prototype = {
initialize: function(overlay, options) {
this.Lay = $(overlay);//覆盖层
//ie6设置覆盖层大小程序
this._size = function(){};
this.SetOptions(options);
this.Color = this.options.Color;
this.Opacity = parseInt(this.options.Opacity);
this.zIndex = parseInt(this.options.zIndex);
this.Set();
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Color:"#fff",//背景色
Opacity:50,//透明度(0-100)
zIndex:1000//层叠顺序
};
Object.extend(this.options, options || {});
},
//创建
Set: function() {
this.Lay.style.display = "none";
this.Lay.style.zIndex = this.zIndex;
this.Lay.style.left = this.Lay.style.top = 0;
if(isIE6){
this.Lay.style.position = "absolute";
this._size = function(){
this.Lay.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px";
this.Lay.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px";
}.bind(this);
//遮盖select
this.Lay.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
} else {
this.Lay.style.position = "fixed";
this.Lay.style.width = this.Lay.style.height = "100%";
}
},
//显示
Show: function() {
//设置样式
this.Lay.style.backgroundColor = this.Color;
//设置透明度
if(isIE){
this.Lay.style.filter = "alpha(opacity:" + this.Opacity + ")";
} else {
this.Lay.style.opacity = this.Opacity / 100;
}
//兼容ie6
if(isIE6){ this._size(); window.attachEvent("onresize", this._size); }
this.Lay.style.display = "block";
},
//关闭
Close: function() {
this.Lay.style.display = "none";
if(isIE6){ window.detachEvent("onresize", this._size); }
}
};
var LightBox = Class.create();
LightBox.prototype = {
initialize: function(box, overlay, options) {
this.Box = $(box);//显示层
this.OverLay = new OverLay(overlay, options);//覆盖层
this.SetOptions(options);
this.Fixed = !!this.options.Fixed;
this.Over = !!this.options.Over;
this.Center = !!this.options.Center;
this.onShow = this.options.onShow;
this.Box.style.zIndex = this.OverLay.zIndex + 1;
this.Box.style.display = "none";
//兼容ie6用的属性
if(isIE6){ this._top = this._left = 0; this._select = []; }
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Fixed:false,//是否固定定位
Over:true,//是否显示覆盖层
Center:false,//是否居中
onShow:function(){}//显示时执行
};
Object.extend(this.options, options || {});
},
//兼容ie6的固定定位程序
_fixed: function(){
var iTop = this.Box.offsetTop + document.documentElement.scrollTop - this._top, iLeft = this.Box.offsetLeft + document.documentElement.scrollLeft - this._left;
//居中时需要修正
if(this.Center){ iTop += this.Box.offsetHeight / 2; iLeft += this.Box.offsetWidth / 2; }
this.Box.style.top = iTop + "px"; this.Box.style.left = iLeft + "px";
this._top = document.documentElement.scrollTop; this._left = document.documentElement.scrollLeft;
},
//显示
Show: function(options) {
//固定定位
if(this.Fixed){
if(isIE6){
//兼容ie6
this.Box.style.position = "absolute";
this._top = document.documentElement.scrollTop; this._left = document.documentElement.scrollLeft;
window.attachEvent("onscroll", this._fixed.bind(this));
} else {
this.Box.style.position = "fixed";
}
} else {
this.Box.style.position = "absolute";
}
//覆盖层
if(this.Over){
//显示覆盖层,覆盖层自带select隐藏
this.OverLay.Show();
} else {
//ie6需要把不在Box上的select隐藏
if(isIE6){
this._select = [];
var oThis = this;
Each(document.getElementsByTagName("select"), function(o){
if(oThis.Box.contains ? !oThis.Box.contains(o) : !(oThis.Box.compareDocumentPosition(o) & 16)){
o.style.visibility = "hidden"; oThis._select.push(o);
}
})
}
}
this.Box.style.display = "block";
//居中
if(this.Center){
this.Box.style.top = this.Box.style.left = "50%";
//显示后才能获取
var iTop = - this.Box.offsetHeight / 2, iLeft = - this.Box.offsetWidth / 2;
//不是fixed或ie6要修正
if(!this.Fixed || isIE6){ iTop += document.documentElement.scrollTop; iLeft += document.documentElement.scrollLeft; }
this.Box.style.marginTop = iTop + "px"; this.Box.style.marginLeft = iLeft + "px";
}
this.onShow();
},
//关闭
Close: function() {
this.Box.style.display = "none";
this.OverLay.Close();
if(isIE6){ window.detachEvent("onscroll", this._fixed); Each(this._select, function(o){ o.style.visibility = "visible"; }); }
}
};
function addEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = fnHandler;
}
};
function removeEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.removeEventListener) {
oTarget.removeEventListener(sEventType, fnHandler, false);
} else if (oTarget.detachEvent) {
oTarget.detachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = null;
}
};
if(!isIE){
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
return this.ownerDocument.defaultView.getComputedStyle(this, null);
});
}
//拖放程序
var Drag = Class.create();
Drag.prototype = {
//拖放对象,触发对象
initialize: function(obj, drag, options) {
var oThis = this;
this._obj = $(obj);//拖放对象
this.Drag = $(drag);//触发对象
this._x = this._y = 0;//记录鼠标相对拖放对象的位置
//事件对象(用于移除事件)
this._fM = function(e){ oThis.Move(window.event || e); }
this._fS = function(){ oThis.Stop(); }
this.SetOptions(options);
this.Limit = !!this.options.Limit;
this.mxLeft = parseInt(this.options.mxLeft);
this.mxRight = parseInt(this.options.mxRight);
this.mxTop = parseInt(this.options.mxTop);
this.mxBottom = parseInt(this.options.mxBottom);
this.mxContainer = this.options.mxContainer;
this.onMove = this.options.onMove;
this.Lock = !!this.options.Lock;
this._obj.style.position = "absolute";
addEventHandler(this.Drag, "mousedown", function(e){ oThis.Start(window.event || e); });
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Limit:false,//是否设置限制(为true时下面参数有用,可以是负数)
mxLeft:0,//左边限制
mxRight:0,//右边限制
mxTop:0,//上边限制
mxBottom:0,//下边限制
mxContainer:null,//指定限制在容器内
onMove:function(){},//移动时执行
Lock:false//是否锁定
};
Object.extend(this.options, options || {});
},
//准备拖动
Start: function(oEvent) {
if(this.Lock){ return; }
//记录鼠标相对拖放对象的位置
this._x = oEvent.clientX - this._obj.offsetLeft;
this._y = oEvent.clientY - this._obj.offsetTop;
//mousemove时移动 mouseup时停止
addEventHandler(document, "mousemove", this._fM);
addEventHandler(document, "mouseup", this._fS);
//使鼠标移到窗口外也能释放
if(isIE){
addEventHandler(this.Drag, "losecapture", this._fS);
this.Drag.setCapture();
}else{
addEventHandler(window, "blur", this._fS);
}
},
//拖动
Move: function(oEvent) {
//判断是否锁定
if(this.Lock){ this.Stop(); return; }
//清除选择(ie设置捕获后默认带这个)
window.getSelection && window.getSelection().removeAllRanges();
//当前鼠标位置减去相对拖放对象的位置得到offset位置
var iLeft = oEvent.clientX - this._x, iTop = oEvent.clientY - this._y;
//设置范围限制
if(this.Limit){
//如果设置了容器,因为容器大小可能会变化所以每次都要设
if(!!this.mxContainer){
this.mxLeft = this.mxTop = 0;
this.mxRight = this.mxContainer.clientWidth;
this.mxBottom = this.mxContainer.clientHeight;
}
//获取超出长度
var iRight = iLeft + this._obj.offsetWidth - this.mxRight, iBottom = iTop + this._obj.offsetHeight - this.mxBottom;
//这里是先设置右边下边再设置左边上边,可能会不准确
if(iRight > 0) iLeft -= iRight;
if(iBottom > 0) iTop -= iBottom;
if(this.mxLeft > iLeft) iLeft = this.mxLeft;
if(this.mxTop > iTop) iTop = this.mxTop;
}
//设置位置
//由于offset是把margin也算进去的所以要减去
this._obj.style.left = iLeft - (parseInt(this._obj.currentStyle.marginLeft) || 0) + "px";
this._obj.style.top = iTop - (parseInt(this._obj.currentStyle.marginTop) || 0) + "px";
//附加程序
this.onMove();
},
//停止拖动
Stop: function() {
//移除事件
removeEventHandler(document, "mousemove", this._fM);
removeEventHandler(document, "mouseup", this._fS);
if(isIE){
removeEventHandler(this.Drag, "losecapture", this._fS);
this.Drag.releaseCapture();
}else{
removeEventHandler(window, "blur", this._fS);
}
}
};
</script>
<style>
.lightbox{width:300px;background:#FFFFFF; top:20%; left:20%;border:1px solid #ccc;line-height:25px; margin:0;}
.lightbox dt{background:#f4f4f4; padding:5px; cursor:move;}
</style>
<dl id="idBox" class="lightbox">
<dt id="idBoxHead"><b>LightBox</b> </dt>
<dd>
选择效果显示
<br /><br />
<input name="" type="button" value=" 关闭 " id="idBoxCancel" /><br /><br />
</dd>
</dl>
<div id="idOverlay"></div>
<div style="margin:0 auto; width:700px; border:1px solid #000000;">
<input name="" type="button" value="关闭覆盖层" id="btnOverlay" />
<input name="" type="button" value="黑色覆盖层" id="btnOverColor" />
<input name="" type="button" value="全透覆盖层" id="btnOverOpacity" />
<input name="" type="button" value="取消居中" id="btnCenter" />
<br /><br />
选择效果:<br />
<select id="idEffect">
<option value="0">还原效果</option>
<option value="4">定位效果</option>
<option value="2">设置拖放</option>
<option value="6">视框定位拖放</option>
</select>
<input name="" type="button" value=" 打开 " id="idBoxOpen" />
<script>
var box = new LightBox("idBox", "idOverlay", { Center: true });
var drag = new Drag("idBox", "idBoxHead", { mxContainer: document.documentElement, Lock: true });
$("idBoxCancel").onclick = function(){ box.Close(); }
$("idBoxOpen").onclick = function(){ box.Show(); }
$("idEffect").onchange = function(){
box.Close();
switch (parseInt(this.value)) {
case 4 :
box.Fixed = true;
drag.Lock = true;
drag.Limit = false;
break;
case 2 :
box.Fixed = false;
drag.Lock = false;
drag.Limit = false;
break;
case 6 :
box.Fixed = true;;
drag.Lock = false;
drag.Limit = true;
break;
case 0 :
default :
box.Fixed = false;
drag.Lock = true;
drag.Limit = false;
}
}
$("btnOverlay").onclick = function(){
box.Close();
if(box.Over){
box.Over = false;
this.value = "打开覆盖层";
} else {
box.Over = true;
this.value = "关闭覆盖层";
}
}
$("btnOverColor").onclick = function(){
box.Close();
box.Over = true;
if(box.OverLay.Color == "#fff"){
box.OverLay.Color = "#000";
this.value = "白色覆盖层";
} else {
box.OverLay.Color = "#fff"
this.value = "黑色覆盖层";
}
}
$("btnOverOpacity").onclick = function(){
box.Close();
box.Over = true;
if(box.OverLay.Opacity == 0){
box.OverLay.Opacity = 50;
this.value = "全透覆盖层";
} else {
box.OverLay.Opacity = 0;
this.value = "半透覆盖层";
}
}
$("btnCenter").onclick = function(){
box.Close();
if(box.Center){
box.Center = false;
this.value = "设置居中";
} else {
box.Center = true;
this.value = "取消居中";
}
}
</script>
<br /><br />
<br />
<br /><br />
<br /><br />
<br /><br /><br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br />
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<br /><br /><br /><br />
<script>
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
function Each(list, fun){
for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
};
var $ = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}
Function.prototype.bind = function(object) {
var __method = this, args = Array.apply(null, arguments); args.shift();
return function() {
return __method.apply(object, args);
}
}
var OverLay = Class.create();
OverLay.prototype = {
initialize: function(overlay, options) {
this.Lay = $(overlay);//覆盖层
//ie6设置覆盖层大小程序
this._size = function(){};
this.SetOptions(options);
this.Color = this.options.Color;
this.Opacity = parseInt(this.options.Opacity);
this.zIndex = parseInt(this.options.zIndex);
this.Set();
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Color:"#fff",//背景色
Opacity:50,//透明度(0-100)
zIndex:1000//层叠顺序
};
Object.extend(this.options, options || {});
},
//创建
Set: function() {
this.Lay.style.display = "none";
this.Lay.style.zIndex = this.zIndex;
this.Lay.style.left = this.Lay.style.top = 0;
if(isIE6){
this.Lay.style.position = "absolute";
this._size = function(){
this.Lay.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px";
this.Lay.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px";
}.bind(this);
//遮盖select
this.Lay.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
} else {
this.Lay.style.position = "fixed";
this.Lay.style.width = this.Lay.style.height = "100%";
}
},
//显示
Show: function() {
//设置样式
this.Lay.style.backgroundColor = this.Color;
//设置透明度
if(isIE){
this.Lay.style.filter = "alpha(opacity:" + this.Opacity + ")";
} else {
this.Lay.style.opacity = this.Opacity / 100;
}
//兼容ie6
if(isIE6){ this._size(); window.attachEvent("onresize", this._size); }
this.Lay.style.display = "block";
},
//关闭
Close: function() {
this.Lay.style.display = "none";
if(isIE6){ window.detachEvent("onresize", this._size); }
}
};
var LightBox = Class.create();
LightBox.prototype = {
initialize: function(box, overlay, options) {
this.Box = $(box);//显示层
this.OverLay = new OverLay(overlay, options);//覆盖层
this.SetOptions(options);
this.Fixed = !!this.options.Fixed;
this.Over = !!this.options.Over;
this.Center = !!this.options.Center;
this.onShow = this.options.onShow;
this.Box.style.zIndex = this.OverLay.zIndex + 1;
this.Box.style.display = "none";
//兼容ie6用的属性
if(isIE6){ this._top = this._left = 0; this._select = []; }
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Fixed:false,//是否固定定位
Over:true,//是否显示覆盖层
Center:false,//是否居中
onShow:function(){}//显示时执行
};
Object.extend(this.options, options || {});
},
//兼容ie6的固定定位程序
_fixed: function(){
var iTop = this.Box.offsetTop + document.documentElement.scrollTop - this._top, iLeft = this.Box.offsetLeft + document.documentElement.scrollLeft - this._left;
//居中时需要修正
if(this.Center){ iTop += this.Box.offsetHeight / 2; iLeft += this.Box.offsetWidth / 2; }
this.Box.style.top = iTop + "px"; this.Box.style.left = iLeft + "px";
this._top = document.documentElement.scrollTop; this._left = document.documentElement.scrollLeft;
},
//显示
Show: function(options) {
//固定定位
if(this.Fixed){
if(isIE6){
//兼容ie6
this.Box.style.position = "absolute";
this._top = document.documentElement.scrollTop; this._left = document.documentElement.scrollLeft;
window.attachEvent("onscroll", this._fixed.bind(this));
} else {
this.Box.style.position = "fixed";
}
} else {
this.Box.style.position = "absolute";
}
//覆盖层
if(this.Over){
//显示覆盖层,覆盖层自带select隐藏
this.OverLay.Show();
} else {
//ie6需要把不在Box上的select隐藏
if(isIE6){
this._select = [];
var oThis = this;
Each(document.getElementsByTagName("select"), function(o){
if(oThis.Box.contains ? !oThis.Box.contains(o) : !(oThis.Box.compareDocumentPosition(o) & 16)){
o.style.visibility = "hidden"; oThis._select.push(o);
}
})
}
}
this.Box.style.display = "block";
//居中
if(this.Center){
this.Box.style.top = this.Box.style.left = "50%";
//显示后才能获取
var iTop = - this.Box.offsetHeight / 2, iLeft = - this.Box.offsetWidth / 2;
//不是fixed或ie6要修正
if(!this.Fixed || isIE6){ iTop += document.documentElement.scrollTop; iLeft += document.documentElement.scrollLeft; }
this.Box.style.marginTop = iTop + "px"; this.Box.style.marginLeft = iLeft + "px";
}
this.onShow();
},
//关闭
Close: function() {
this.Box.style.display = "none";
this.OverLay.Close();
if(isIE6){ window.detachEvent("onscroll", this._fixed); Each(this._select, function(o){ o.style.visibility = "visible"; }); }
}
};
function addEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = fnHandler;
}
};
function removeEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.removeEventListener) {
oTarget.removeEventListener(sEventType, fnHandler, false);
} else if (oTarget.detachEvent) {
oTarget.detachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = null;
}
};
if(!isIE){
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
return this.ownerDocument.defaultView.getComputedStyle(this, null);
});
}
//拖放程序
var Drag = Class.create();
Drag.prototype = {
//拖放对象,触发对象
initialize: function(obj, drag, options) {
var oThis = this;
this._obj = $(obj);//拖放对象
this.Drag = $(drag);//触发对象
this._x = this._y = 0;//记录鼠标相对拖放对象的位置
//事件对象(用于移除事件)
this._fM = function(e){ oThis.Move(window.event || e); }
this._fS = function(){ oThis.Stop(); }
this.SetOptions(options);
this.Limit = !!this.options.Limit;
this.mxLeft = parseInt(this.options.mxLeft);
this.mxRight = parseInt(this.options.mxRight);
this.mxTop = parseInt(this.options.mxTop);
this.mxBottom = parseInt(this.options.mxBottom);
this.mxContainer = this.options.mxContainer;
this.onMove = this.options.onMove;
this.Lock = !!this.options.Lock;
this._obj.style.position = "absolute";
addEventHandler(this.Drag, "mousedown", function(e){ oThis.Start(window.event || e); });
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Limit:false,//是否设置限制(为true时下面参数有用,可以是负数)
mxLeft:0,//左边限制
mxRight:0,//右边限制
mxTop:0,//上边限制
mxBottom:0,//下边限制
mxContainer:null,//指定限制在容器内
onMove:function(){},//移动时执行
Lock:false//是否锁定
};
Object.extend(this.options, options || {});
},
//准备拖动
Start: function(oEvent) {
if(this.Lock){ return; }
//记录鼠标相对拖放对象的位置
this._x = oEvent.clientX - this._obj.offsetLeft;
this._y = oEvent.clientY - this._obj.offsetTop;
//mousemove时移动 mouseup时停止
addEventHandler(document, "mousemove", this._fM);
addEventHandler(document, "mouseup", this._fS);
//使鼠标移到窗口外也能释放
if(isIE){
addEventHandler(this.Drag, "losecapture", this._fS);
this.Drag.setCapture();
}else{
addEventHandler(window, "blur", this._fS);
}
},
//拖动
Move: function(oEvent) {
//判断是否锁定
if(this.Lock){ this.Stop(); return; }
//清除选择(ie设置捕获后默认带这个)
window.getSelection && window.getSelection().removeAllRanges();
//当前鼠标位置减去相对拖放对象的位置得到offset位置
var iLeft = oEvent.clientX - this._x, iTop = oEvent.clientY - this._y;
//设置范围限制
if(this.Limit){
//如果设置了容器,因为容器大小可能会变化所以每次都要设
if(!!this.mxContainer){
this.mxLeft = this.mxTop = 0;
this.mxRight = this.mxContainer.clientWidth;
this.mxBottom = this.mxContainer.clientHeight;
}
//获取超出长度
var iRight = iLeft + this._obj.offsetWidth - this.mxRight, iBottom = iTop + this._obj.offsetHeight - this.mxBottom;
//这里是先设置右边下边再设置左边上边,可能会不准确
if(iRight > 0) iLeft -= iRight;
if(iBottom > 0) iTop -= iBottom;
if(this.mxLeft > iLeft) iLeft = this.mxLeft;
if(this.mxTop > iTop) iTop = this.mxTop;
}
//设置位置
//由于offset是把margin也算进去的所以要减去
this._obj.style.left = iLeft - (parseInt(this._obj.currentStyle.marginLeft) || 0) + "px";
this._obj.style.top = iTop - (parseInt(this._obj.currentStyle.marginTop) || 0) + "px";
//附加程序
this.onMove();
},
//停止拖动
Stop: function() {
//移除事件
removeEventHandler(document, "mousemove", this._fM);
removeEventHandler(document, "mouseup", this._fS);
if(isIE){
removeEventHandler(this.Drag, "losecapture", this._fS);
this.Drag.releaseCapture();
}else{
removeEventHandler(window, "blur", this._fS);
}
}
};
</script>
<style>
.lightbox{width:300px;background:#FFFFFF; top:20%; left:20%;border:1px solid #ccc;line-height:25px; margin:0;}
.lightbox dt{background:#f4f4f4; padding:5px; cursor:move;}
</style>
<dl id="idBox" class="lightbox">
<dt id="idBoxHead"><b>LightBox</b> </dt>
<dd>
选择效果显示
<br /><br />
<input name="" type="button" value=" 关闭 " id="idBoxCancel" /><br /><br />
</dd>
</dl>
<div id="idOverlay"></div>
<div style="margin:0 auto; width:700px; border:1px solid #000000;">
<input name="" type="button" value="关闭覆盖层" id="btnOverlay" />
<input name="" type="button" value="黑色覆盖层" id="btnOverColor" />
<input name="" type="button" value="全透覆盖层" id="btnOverOpacity" />
<input name="" type="button" value="取消居中" id="btnCenter" />
<br /><br />
选择效果:<br />
<select id="idEffect">
<option value="0">还原效果</option>
<option value="4">定位效果</option>
<option value="2">设置拖放</option>
<option value="6">视框定位拖放</option>
</select>
<input name="" type="button" value=" 打开 " id="idBoxOpen" />
<script>
var box = new LightBox("idBox", "idOverlay", { Center: true });
var drag = new Drag("idBox", "idBoxHead", { mxContainer: document.documentElement, Lock: true });
$("idBoxCancel").onclick = function(){ box.Close(); }
$("idBoxOpen").onclick = function(){ box.Show(); }
$("idEffect").onchange = function(){
box.Close();
switch (parseInt(this.value)) {
case 4 :
box.Fixed = true;
drag.Lock = true;
drag.Limit = false;
break;
case 2 :
box.Fixed = false;
drag.Lock = false;
drag.Limit = false;
break;
case 6 :
box.Fixed = true;;
drag.Lock = false;
drag.Limit = true;
break;
case 0 :
default :
box.Fixed = false;
drag.Lock = true;
drag.Limit = false;
}
}
$("btnOverlay").onclick = function(){
box.Close();
if(box.Over){
box.Over = false;
this.value = "打开覆盖层";
} else {
box.Over = true;
this.value = "关闭覆盖层";
}
}
$("btnOverColor").onclick = function(){
box.Close();
box.Over = true;
if(box.OverLay.Color == "#fff"){
box.OverLay.Color = "#000";
this.value = "白色覆盖层";
} else {
box.OverLay.Color = "#fff"
this.value = "黑色覆盖层";
}
}
$("btnOverOpacity").onclick = function(){
box.Close();
box.Over = true;
if(box.OverLay.Opacity == 0){
box.OverLay.Opacity = 50;
this.value = "全透覆盖层";
} else {
box.OverLay.Opacity = 0;
this.value = "半透覆盖层";
}
}
$("btnCenter").onclick = function(){
box.Close();
if(box.Center){
box.Center = false;
this.value = "设置居中";
} else {
box.Center = true;
this.value = "取消居中";
}
}
</script>
<br /><br />
<br />
<br /><br />
<br /><br />
<br /><br /><br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br />
</div>
</body>
</html>
发表评论
-
JS加减乘除运算
2013-09-03 12:13 1463//加法 Number.prototype.ad ... -
JS 利用正则表达式替换字符串
2013-08-15 15:46 9645JS 利用正则表达式替换字符串 var data = & ... -
JS验证
2013-07-19 11:43 10991. URL验证 function checkU ... -
JS常用方法
2013-06-14 11:48 948//1. 去空格 function doTrimStr( ... -
在JS弹出的遮罩层中,部分区域高亮显示并且可以编辑
2012-11-13 10:37 31591. 初始页面效果如下所示: 2. 点击“点击一下试试!”链 ... -
IE9浏览器下 使用JS获取图片尺寸大小 的方法
2012-11-01 15:17 4636情况一:以下代码在IE7、IE8下获取图片的尺寸大小是没有问题 ... -
JS遍历某个目录下的所有文件名
2011-02-23 18:46 4757<!DOCTYPE HTML PUBLIC " ... -
JAVASCRIPT----style 中visibility和display之间的区别
2009-08-13 16:06 1561大多数人很容易将CSS属 ... -
javascript自定义右键菜单
2009-02-06 18:56 2159<title>右键菜单v1.0</title ... -
javascript仿照google搜索框自动补全(可以输入一个“管”字查看效果。)
2009-02-06 18:51 5110<html> <body> <s ... -
javascript在线将汉字翻译为汉语拼音,可选择翻译中汉字对照
2009-02-06 18:16 3507<html> <head> <t ... -
点击链接弹出"图片另存为"而不是直接打开
2009-02-06 18:02 1751<iframe height="0" ... -
javascript实现页内搜索
2009-02-06 18:00 1282<!DOCTYPE html PUBLIC " ... -
jst实现MD5加密
2009-02-06 17:55 1191<HTML> <HEAD> <M ... -
javascript图片型按钮
2009-02-06 17:46 1291<style>.button { font: 12 ... -
javascript页面loading效果
2009-02-06 17:44 1699<html> <head> <t ... -
上传附件界面设计
2009-02-06 17:37 1369<head> <meta http-equ ... -
js停止输出
2009-02-06 17:13 991<SCRIPT LANGUAGE="Jav ... -
网站后台左右收缩型页面脚本
2009-02-06 17:06 1365<html> <meta http-equi ... -
文本框点击时文字消失,失去焦点时文字出现
2009-02-06 16:55 1914<!DOCTYPE HTML PUBLIC " ...
相关推荐
近来要做一个LightBox的效果(也有的叫Windows关机效果),不过不用那么复杂,能显示一个内容框就行了。 这个效果很久以前就做过,无非就是一个覆盖全屏的层,加一个内容显示的层。不过showbo教了我position:fixed这...
在本项目中,我们探讨的是如何使用JavaScript实现一个图片查看器,该查看器模仿了知名的Lightbox效果。Lightbox是一种流行的设计模式,当用户点击图片时,会在当前页面上以全屏、半透明背景的形式展示大图,提供更佳...
"仿LightBox效果提示框"是一种常见的网页设计技术,它基于JavaScript(js)实现,灵感来源于经典的LightBox特效。LightBox最初是用来展示图片的,当用户点击一张缩略图时,图片会在当前页面上以半透明背景和居中显示...
在这个实例中,我们将深入探讨如何使用JavaScript DOM技术来创建一个仿LightBox效果的提示框。LightBox是一种常见的图片预览功能,当用户点击图片时,图片会在当前页面上以半透明背景下的全屏模式显示,提供了一种...
标题中的“仿Lightbox效果”指的是在网页设计中模拟Lightbox这一流行JavaScript库的效果。Lightbox通常用于在网页上展示图片、视频或任何其他媒体,它会在用户点击一个链接后弹出一个模态窗口,将内容置于当前页面之...
在本案例中,我们关注的是一个基于jQuery库实现的仿LightBox效果的图片展示插件。jQuery是一个轻量级、高性能的JavaScript库,它简化了HTML文档遍历、事件处理、动画设计和Ajax交互。 LightBox是一种常见的图片查看...
《jQuery UI.ariaLightbox:JavaScript中的Lightbox效果实现》 在Web开发中,为了提供更好的用户体验,我们经常需要在用户点击图片时将其放大显示,而不在原网页中打开新窗口或新页面。Lightbox技术就是为此目的...
### JavaScript仿Windows关机效果详解 #### 一、概述 在网页开发中,为了增加用户体验,开发者们常常会模仿各种操作系统的行为,其中一种常见的做法就是模拟Windows系统的关机动画效果。这种效果通常通过...
【标题】"仿LightBox图片盒子-YLightBox照片展示特效"是基于JavaScript和CSS实现的一种网页图片展示技术,它借鉴了流行的LightBox效果,为用户提供了一种优雅且沉浸式的图片浏览体验。LightBox效果通常指的是当用户...
Lightbox通常使用JavaScript库实现,如jQuery Lightbox、Fancybox或Magnific Popup等,这些库提供了丰富的自定义选项和动画效果,使得开发者可以轻松集成到自己的网站中。 在实际应用中,仿Win8布局和lightbox插件...
《jQuery Lightbox 0.5:仿腾讯空间相册弹出层显示技术解析》 在网页设计中,图片展示是一个重要的组成部分,特别是在个人空间或相册应用中。腾讯空间的相册功能以其简洁、直观的设计深受用户喜爱,尤其是点击缩略...
JavaScript实现仿Windows关机效果是一种在网页中模拟操作系统关机界面的设计手法,它主要通过创建图层并控制其样式来实现。这一效果不仅能够提供一种视觉上的交互体验,还可以帮助防止用户在执行特定操作时进行误...
JavaScript仿关机效果的图片层是一种利用特定库如YUI(Yahoo User Interface Library)实现的交互式图片展示技术。在Web开发中,这种效果通常被称为Lightbox,它为用户提供了一种全屏、沉浸式的查看大图的方式,类似...
86. 分享一款jquery仿lightbox无刷新图片显示插件PrettyPhoto下载 87. 分享多款jQuery图片预加载切换效果(上下滚动、淡入淡出渐变等) 88. 动感十足jquery仿腾讯图片滚动浏览功能(带左右控制按钮)MovingBoxes插件...
8. JavaScript:虽然没有直接列出,但考虑到Lightbox功能,项目中很可能使用了JavaScript来处理图片的动态加载和弹窗效果。 这个项目可以作为学习HTML5、响应式设计、Bootstrap以及Lightbox应用的一个实例,对于想...
86. 分享一款jquery仿lightbox无刷新图片显示插件PrettyPhoto下载 87. 分享多款jQuery图片预加载切换效果(上下滚动、淡入淡出渐变等) 88. 动感十足jquery仿腾讯图片滚动浏览功能(带左右控制按钮)MovingBoxes插件...
本文将深入探讨“Win8布局 lightbox弹出层插件”,这是一个利用jQuery实现的仿Windows 8(Win8)界面风格的Lightbox效果插件。 首先,让我们了解什么是Lightbox。Lightbox是一种网页设计技术,当用户点击一个图片...
标题中的“简单动画css3动画个人博客blog仿flash响应式ajax响应式个人主页lightbox摄影图片相册迷你html5”揭示了这个压缩包包含的是一个基于HTML5、CSS3和Ajax技术构建的个人博客模板,其特点包括动画效果、响应式...
3. **漂亮动感的lightbox弹出层插件**:Lightbox是一种常见的图片预览技术,当用户点击图片链接时,会在当前页面上以半透明背景的弹窗显示大图。这个JavaScript插件可能涉及到CSS3动画、事件处理和图片加载优化等...
内容索引:脚本资源,Ajax/JavaScript,图片放大 JavaScript新手写的图片当前页放大显示效果插件,仿LightBox的功能,哈哈!第一个js效果,虽然比较烂,但很有成就感!点击小图片,可在当前位置加载大图,现在很流行的...