这个是例如了CSS的margin负值和相对定位做的一个图片放大的效果。图片开始只是局部的,鼠标放上去显示整个图片。
body{ font-size:12px; }
ul,li,ol{ margin:0; padding:0; list-style:none; }
.box{ margin:100px; clear:both; border:1px solid #000; }
.box ul li{ list-style:none; float:left; width:60px; height:60px; margin-left:10px; text-align:center; border:1px solid #ccc; }
.box ul li a{ display:block; background:#f2f2f2; width:60px; height:60px; overflow:hidden; }
.box a img{ margin:-25px 0px 0px -25px; border:0; }
.box a:hover{ width:105px; height:140px; border:4px solid #f2f2f2; margin:-40px -50px -80px -50px; padding:1px; position:relative; }/* 设置相对定位后才能盖住后面的层 */
.box a:hover img{ margin:0; border:0; }
.clear{clear:both;overflow:hidden;height:0;}
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
您可能感兴趣的文章:
- JS实现侧边栏鼠标经过弹出框+缓冲效果
- js鼠标经过tab选项卡时实现切换延迟
- 原生态js,鼠标按下后,经过了那些单元格的简单实例
- JS+CSS实现鼠标经过弹出一个DIV框完整实例(带缓冲动画渐变效果)
- js实现鼠标经过表格行变色的方法
- js实现鼠标经过时图片滚动停止的方法
- JS实现鼠标经过好友列表中的好友头像时显示资料卡的效果
- 鼠标经过显示二级菜单js特效
- javascript学习笔记(二) 鼠标经过时,改变div块的背景色的代码
- Javascript实现的鼠标经过时播放声音
- vue实现鼠标经过动画