求个浏览图片的特效,求大神给个例子或说一下用什么插件可以解决这个问题 在jsp页面里实现查看图片的效果,就是类似于QQ的聊天窗口查看图片的效果,点击图片出来个带关闭按钮的框,滚动滚轮图片能放大求个demo或者能实现这个效果的插件图片插件jsp图片放大 浏览 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没见到过这样的插件 很难找到完全符合你要求的插件的吧 貌似function createScreen(src/*屏蔽层上显示的图像地址*/,parentDom/*屏蔽层的父元素*/){ var div=document.createElement("div"); var screenStyle=getScreenStyle(); parentDom=parentDom||document.body; var style={ 'width':screenStyle.width+"px", 'height':screenStyle.height+"px", 'position':'fixed', 'left':'0px', 'top':'0px', 'opacity':.6, 'filter':'alpha(opacity=60)', 'zIndex':5000, 'backgroundColor':'black' } setStyle(div,style); var img=new Image(); img.src=src; //需要在图片加载完毕后创建屏蔽层 否则无法计算图片高宽 img.onload=function(){ style={ 'position':'fixed', 'left':(screenStyle.width-img.width)/2+"px", 'zIndex':5001, 'top':(screenStyle.height-img.height)/2+"px" } setStyle(img,style); var text=document.createElement("div"); //text.innerHTML='数据正在加载..'; style={ 'position':'fixed', 'zIndex':5002, 'top':parseInt(img.style.top)+parseInt(img.height)+"px", 'left':(screenStyle.width-img.width)/2-20+"px", 'color':'white' } setStyle(text,style); parentDom.appendChild(div); parentDom.appendChild(img); parentDom.appendChild(text); screenDiv=div; screenImage=img; screenParent=parentDom; //当窗口大小发生变化时重新计算 window.onresize=function(){ screenStyle=getScreenStyle(); style={ 'width':screenStyle.width+"px", 'height':screenStyle.height+"px" } setStyle(div,style); style={ 'left':(screenStyle.width-img.width)/2+"px", 'top':(screenStyle.height-img.height)/2+"px" } setStyle(img,style); style={ 'top':parseInt(img.style.top)+parseInt(img.height)+"px", 'left':(screenStyle.width-img.width)/2-20+"px" } setStyle(text,style); } } img.onerror=function(){ alert('图片加载错误'); } img.onabort=function(){ alert('图片加载失败'); } } 滚动放大缩小监视onscroll事件改变img的width 和height试试 关于按钮点击以后不能重复点击 js 怎么实现左键的下载功能 Ext jsonstore取不到值不知道是什么问题 如何设置使某个iframe内的所有控件无效,变灰 js下拉菜单,在不同ie中的显示问题 图片轮换显示??? 贡献一个小小的在线文本编辑器DIVText 关于正则表达式的问题(急急急啊!!!!!!) 如何取得文件名?在线等待! 为什么我写的代码不能播放声音?? 关于正则表达式的 以下条件能用SWITCH语句方便的判断吗
function createScreen(src/*屏蔽层上显示的图像地址*/,parentDom/*屏蔽层的父元素*/){
var div=document.createElement("div");
var screenStyle=getScreenStyle();
parentDom=parentDom||document.body;
var style={
'width':screenStyle.width+"px",
'height':screenStyle.height+"px",
'position':'fixed',
'left':'0px',
'top':'0px',
'opacity':.6,
'filter':'alpha(opacity=60)',
'zIndex':5000,
'backgroundColor':'black'
}
setStyle(div,style);
var img=new Image();
img.src=src;
//需要在图片加载完毕后创建屏蔽层 否则无法计算图片高宽
img.onload=function(){
style={
'position':'fixed',
'left':(screenStyle.width-img.width)/2+"px",
'zIndex':5001,
'top':(screenStyle.height-img.height)/2+"px"
}
setStyle(img,style);
var text=document.createElement("div");
//text.innerHTML='数据正在加载..';
style={
'position':'fixed',
'zIndex':5002,
'top':parseInt(img.style.top)+parseInt(img.height)+"px",
'left':(screenStyle.width-img.width)/2-20+"px",
'color':'white'
}
setStyle(text,style);
parentDom.appendChild(div);
parentDom.appendChild(img);
parentDom.appendChild(text);
screenDiv=div;
screenImage=img;
screenParent=parentDom;
//当窗口大小发生变化时重新计算
window.onresize=function(){
screenStyle=getScreenStyle();
style={
'width':screenStyle.width+"px",
'height':screenStyle.height+"px"
}
setStyle(div,style);
style={
'left':(screenStyle.width-img.width)/2+"px",
'top':(screenStyle.height-img.height)/2+"px"
}
setStyle(img,style);
style={
'top':parseInt(img.style.top)+parseInt(img.height)+"px",
'left':(screenStyle.width-img.width)/2-20+"px"
}
setStyle(text,style);
}
}
img.onerror=function(){
alert('图片加载错误');
}
img.onabort=function(){
alert('图片加载失败');
}
}
滚动放大缩小监视onscroll事件改变img的width 和height试试