元素缩放
<style>
div{background:#CCCCCC;text-align:center;}
#first{float:left;width:100px; height:150px; line-height:150px;}
#second{clear:left;float:left;margin-top:10px;width:100px;height:150px; line-height:150px;}
#third{zoom:1; width:200px;margin-left:110px; height:310px; line-height:310px;}
</style>
</head>
<body>
<div id="first">A</div>
<div id="second">B</div>
<div id="third">C</div>
</body>
<script>
window.onload = function() {
function zoom(id,x,y){
// 设置缩放函数参数:容器id、横向缩放倍数、纵向缩放倍数(等比例缩放时也可以设定一个参数)
var obj=document.getElementById(id);
// 获取元素对象值
var dW=obj.clientWidth;
// 获取元素宽度
var dH=obj.clientHeight;
// 获取元素高度
//var dW=obj.offsetTop;
//var dH=obj.offsetLeft;
obj.οnmοuseοver=function(){
// 鼠标移入
this.style.width=dW*x+"px";
// 横向缩放
this.style.height=dH*y+"px";
// 纵向缩放
this.style.backgroundColor="#f00";
// 设置调试背景
//this.style.zIndex=1;
// 设置z轴优先
}
obj.οnmοuseοut=function(){
// 鼠标移出,设回默认值
this.style.width="";
this.style.height="";
this.style.padding="";
this.style.backgroundColor="";
this.style.zIndex="";
}
}
zoom("first",1.25,1.25);
zoom("second",1.25,1.25);
zoom("third",1.25,1.25);
}
</script>
转载于:https://www.cnblogs.com/liangxuru/p/5698982.html
- zoom元素用来设置缩放比例的
- 【移动端元素按比例缩放】用Padding-buttom撑开高度
- 利用padding百分比,继承父级元素宽度,实现元素宽高比例缩放
- 【插件】移动端元素拖拽、缩放
- 响应式,图片与其他元素一同等比缩放
- jQuery支持移动Mobile的DOM元素移动和缩放插件
- 当鼠标进入li标签,给标签中的img元素加缩放效果
- jQuery照片伸缩效应,这不是一个简单的图像缩放,它不影响其它元素的布局
- 利用padding百分比继承父级元素宽度特性实现元素宽高比例缩放
- css 实现元素长宽等比缩放
- 可缩放Reloaded-一个针对可缩放元素的复用组件
- transform属性 2D转换 对元素进行旋转、缩放、移动、拉伸
- CSS样式之transform(对元素的旋转、缩放、移动或倾斜)
- jQuery实现可移动(draggable)和可缩放(sizable)网页元素
- SVG元素缩放的问题
- css3之元素的缩放、渐变、旋转和平移
- 可缩放Reloaded-一个针对可缩放元素的复用组件
- CSS计量单位-实现元素大小随页面同步缩放
- jQuery支持移动Mobile的DOM元素移动和缩放插件
- CSS==元素自适应屏幕大小,等比缩放