图片翻转效果具体实现代码

(编辑:jimmy 日期: 2024/10/15 浏览:2)

以下为程序代码:
复制代码 代码如下:
<!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>

效果预览:http://biyuan.tk/u/upload/201310221500310000.html
一句话新闻
一文看懂荣耀MagicBook Pro 16
荣耀猎人回归!七大亮点看懂不只是轻薄本,更是游戏本的MagicBook Pro 16.
人们对于笔记本电脑有一个固有印象:要么轻薄但性能一般,要么性能强劲但笨重臃肿。然而,今年荣耀新推出的MagicBook Pro 16刷新了人们的认知——发布会上,荣耀宣布猎人游戏本正式回归,称其继承了荣耀 HUNTER 基因,并自信地为其打出“轻薄本,更是游戏本”的口号。
众所周知,寻求轻薄本的用户普遍更看重便携性、外观造型、静谧性和打字办公等用机体验,而寻求游戏本的用户则普遍更看重硬件配置、性能释放等硬核指标。把两个看似难以相干的产品融合到一起,我们不禁对它产生了强烈的好奇:作为代表荣耀猎人游戏本的跨界新物种,它究竟做了哪些平衡以兼顾不同人群的各类需求呢?