鼠标滑过放大不影响布局
2016-06-24 15:13
204 查看
HTML代码:
<body>
<div class="left_1" id="left_1"></div>
<div class="left_2" id="left_2"></div>
<div class="right" id="right"></div>
</body>
css代码:
<style>
*{
padding:0;
margin:0;
}
div{
position:absolute;
background-color:grey;
}
.left_1{
width:100px;
height:150px;
}
.left_2{
width:100px;
height:150px;
top:160px;
}
.right{
width:300px;
height:310px;
left:110px;
}
css方法:
/*.left_1:hover{
width:120px;
height:170px;
z-index:1;
background-color:red;
}*/
</style>
js实现方法代码:
js方法:
<script>
window.onload=function(){
function hightlight(id,x ,y){
var div=document.getElementById(id);
var oriwidth=div.clientWidth;
var oriheight=div.clientHeight;
div.onmouseover=function(){
this.style.width=oriwidth*x+'px';
this.style.height=oriheight*y+'px';
this.style.backgroundColor="red";
this.style.zIndex=1;
}
div.onmouseout=function(){
this.style.width="";
this.style.height="";
this.style.backgroundColor="";
this.style.zIndex="";
}
}
hightlight("left_1",1.25,1.25)
hightlight("left_2",1.25,1.25)
hightlight("right",1.25,1.25)
}
</script>
相关文章推荐
- Android中ListView与CheckBox结合----多选与记录
- Android一个工程引用另一个工程
- 架构:分层、分块与协作、服务。
- 转: Android入门及效率开发
- python 元祖(tuple)
- Java实验(14) MyRational
- Android动画(Animations)
- 我的51成长之路
- Nginx google 扩展
- Gitblit 服务器的搭建
- 【转载】Matlab中如何加载.mat变成矩阵形式
- 【JAVA】简易记事本NotePad
- Python中集合(set)类型
- 用IntelliJ IDEA创建Gradle项目简单入门
- 我的arm_linux移植笔记
- 欢迎使用CSDN-markdown编辑器
- 个人简历工作地点的选择(Android开源项目)
- [linux] 进度条
- 二维透视投影变换
- Genero BDL 数据类型(1)