图片翻转效果

以下为程序代码:
<!DOCTYPE html />
<html>
<head>
<meta http-equiv="Content-Typecontent="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatiblecontent="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>

效果预览:http://biyuan.tk/u/upload/201310221500310000.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值