
function bbimg(o)...{
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
function imgzoom(img,maxsize)...{
var a=new Image();
a.src=img.src
if(a.width > maxsize * 4)
...{
img.style.width=maxsize;
}
else if(a.width >= maxsize)
...{
img.style.width=Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4);
}
return false;
}
本文介绍了一种利用JavaScript实现图片自动缩放的方法,确保图片在不同尺寸的屏幕上能够适应显示,并且通过鼠标滚轮实现了图片的交互式缩放功能。
5万+

被折叠的 条评论
为什么被折叠?



