图片翻转效果具体实现代码
2014-01-09 17:02
295 查看
<!DOCTYPE html /> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>图片翻转效果</title> <style type="text/css"> .box {overflow:hidden;position:relative;} .txt {width:100%;height:100%;background:#f51146;font-size:12px;position:absolute;top:-100%;color:white; text-align:center;filter:alpha(Opacity=80);-moz-opacity:0.8;opacity:0.8;} #b1 {background:url(http://biyuan.tk/u/upload/201310221457326875.jpg);width:232px;height:232px;} #b2 {background:url(http://biyuan.tk/u/upload/201310221457486875.jpg);width:110px;height:110px;} #b3 {background:url(http://biyuan.tk/u/upload/201310221458149843.jpg);width:110px;height:110px;} </style> </head> <body> <div id="obj"> <div class="box" id="b1"><div class="txt">文字说明<br />文字说明</br />文字</div></div> <div class="box" id="b2"><div class="txt">文字说明<br />文字说明</br />文字</div></div> <div class="box" id="b3"><div class="txt">文字说明<br />文字说明</br />文字</div></div> </div> <script type="text/javascript"> function Show(o, s, v){ clearInterval(Show.prototype["a" + v]); Show.prototype["a" + v] = setInterval(function(){ if(s == -1) { if(o.offsetTop <= -o.parentNode.offsetHeight) { o.style.top = -o.parentNode.offsetHeight + "px"; return clearInterval(Show.prototype["a" + v]); } } else { if(o.offsetTop >= -10) { o.style.top = 0; return clearInterval(Show.prototype["a" + v]); } } o.style.top = (o.offsetTop * 1 + 10 * s) + "px"; }, 10); } var igs = document.getElementById('obj').getElementsByTagName("div"); for(var i = 0; i < igs.length; i ++) { if(igs[i].className == "box") { (function(x){ igs[x].onmouseover = function(){ Show(this.childNodes[0], 1, x); this.onmouseout = function() { Show(this.childNodes[0], -1, x); } } })(i); } } </script> </body> </html>
相关文章推荐
- 图片翻转效果具体实现代码
- 巧用CSS3 border实现图片遮罩效果代码
- 基于jquery实现的上传图片及图片预览效果代码
- jQuery实现图片轮播效果代码(基于jquery.pack.js插件)
- jquery实现简单的图片翻转效果
- JS实现图片翻书效果示例代码
- 图片的左右移动,js动画效果实现代码
- java实现的图片缩放 压缩 裁剪工具!找了很久,市面上再也找不到比它缩放效果还好的代码了
- jquery实现上传图片及图片大小验证、图片预览效果代码
- JS小功能(offsetLeft实现图片滚动效果)实例代码
- JS小功能(setInterval实现图片效果显示时间)实例代码
- 花式实现图片3D翻转效果
- jquery实现图片水平滚动效果代码分享
- HTML5 Canvas实现图片缩放、翻转、颜色渐变的代码示例
- 图片叠加效果Java代码实现
- 纯js实现背景图片切换效果代码
- javascript实现多张图片轮流展示效果代码
- [Egret学习笔记 七]使用skewX skewY实现图片翻转效果
- 用CSS实现图片水印效果代码
- jquery实现鼠标拖动图片效果示例代码