鼠标滚轮改变图片大小的示例代码
发布时间:2016-12-30 来源:查字典编辑
摘要:鼠标滚轮改变图片大小的示例代码functiononWheelZoom(obj){zoom=parseFloat(obj.style.zoom...
鼠标滚轮改变图片大小的示例代码
<script>
function onWheelZoom(obj){
zoom = parseFloat(obj.style.zoom);
tZoom = zoom + (event.wheelDelta>0 ? 0.05 : -0.05);
if( tZoom > 1 || tZoom<0.1 ) return true;
obj.style.zoom=tZoom;
return false;
}
</script>
<a href="javascript:window.close()"><img
src="http://files.jb51.net/file_images/article/201311/20131120101711.png"
onmousewheel='return onWheelZoom(this)'></a>