首页 > 代码库 > 鼠标滚轮改变图片大小
鼠标滚轮改变图片大小
<script type="text/javascript"> window.onresize = function () { shade.style.height = document.documentElement.clientHeight + "px"; shade.style.width = document.documentElement.clientWidth + "px"; ImageCenter(); } function ImageCenter() { divDetail.style.left = (document.documentElement.clientWidth - divDetail.clientWidth) / 2 + "px"; divDetail.style.top = (document.documentElement.clientHeight - divDetail.clientHeight) / 2 + "px"; } function MakeSize(e) { var zoom = parseInt(e.style.zoom, 10) || 100; zoom += event.wheelDelta / 12; if (zoom > 360) return; if (zoom > 0) e.style.zoom = zoom + ‘%‘; ImageCenter(); } </script>
<div id="Shade" style="opacity: 0.5; position: absolute; left: 0px; top: 0px; z-index: 1000; background: rgb(0, 0, 0);" onclick="ShadeClick();"> </div> <div id="divDetail" style="zoom: 1; opacity: 1; position: absolute; z-index: 1001;"> <img id="detailImage" onm ousewheel="return MakeSize(this);" style="cursor: pointer;"> </div>
鼠标滚轮改变图片大小
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。