JavaScript图片放大效果详解
作者:互联网
2009-10-27
效果:
放大的图像大小为,原始图像大小*比例值,代码如下: css(m.img,{ 由于放大是根据比例进行放大,所以在浏览框上和放大图像上需要仔细计算,这也就是该程序的主要思维之一。 相关标签:
css(m.mag,{
'display' : 'none',
'width' : m.cont.clientWidth + 'px', //m.cont为原始图像
'height' : m.cont.clientHeight + 'px',
'position' : 'absolute',
'left' : m.cont.offsetLeft + m.cont.offsetWidth + 10 + 'px', //放大框的位置为原始图像的右方远10px
'top' : m.cont.offsetTop + 'px'
})
'position' : 'absolute',
'width' : (m.cont.clientWidth * m.scale) + 'px', //原始图像的宽*比例值
'height' : (m.cont.clientHeight * m.scale) + 'px' //原始图像的高*比例值
})
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
「性能优化」虚拟列表极致优化实战:从原理到源码,打造丝滑滚动体验
你的 Vue 3 生命周期,VuReact 会编译成什么样的 React?
你的 Vue 3 defineProps(),VuReact 会编译成什么样的 React?
Vue条件渲染详解:v-if、v-show用法与实战指南
前端性能内卷终点?Signals 正在重塑我们的开发习惯
使用 IntersectionObserver + 哨兵元素实现长列表懒加载
大屏卡成 PPT?这 3 个性能优化招数亲测有效
别再用 JSON.parse 深拷贝了,聊聊 StructuredClone
当 Vue 3 遇上桥接模式:手把手教你优雅剥离虚拟滚动的业务大泥球
VueUse 全面指南|Vue3组合式工具集实战
AI精选
