鼠标放到图片上会滑出提示文字
2016-07-11 11:27
218 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>滑动提示</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
*{margin:0;padding:0;font-size:12px}
ul,ol{list-style-type:none}
#show{background:white;height:180px;width:180px;position:relative;overflow:hidden;text-align:center}
#show h2{position:absolute;height:50px;text-align:center;line-height:50px;width:100%;opacity:0.5;background:black;color:white;left:0;bottom:0}
</style>
<script>
function go(){
var t,tt;
var _div=document.getElementById("show");
var obj=_div.getElementsByTagName('h2')[0];
obj.style.bottom="-50px";
var change=function(){
var obj_h=parseInt(obj.style.bottom);
if(obj_h<0){obj.style.bottom=(obj_h+Math.floor((0-obj_h)*0.1))+"px"}//if
else{clearInterval(t)}
}
var back=function(){
var obj_hh=parseInt(obj.style.bottom);
if(obj_hh>-50){obj.style.bottom=(obj_hh+Math.floor((-50-obj_hh)*0.1))+"px"}
else{clearInterval(tt)}
}
_div.onmouseover=function(){clearInterval(tt);t=setInterval(change,10);}
_div.onmouseout=function(){clearInterval(t);tt=setInterval(back,10)}
}
window.onload=function(){
go();
}
</script>
</head>
<body>
<div id="show">
<h2>北国南疆,风光无限</h2>
<img src="wall2.jpg" />
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>滑动提示</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
*{margin:0;padding:0;font-size:12px}
ul,ol{list-style-type:none}
#show{background:white;height:180px;width:180px;position:relative;overflow:hidden;text-align:center}
#show h2{position:absolute;height:50px;text-align:center;line-height:50px;width:100%;opacity:0.5;background:black;color:white;left:0;bottom:0}
</style>
<script>
function go(){
var t,tt;
var _div=document.getElementById("show");
var obj=_div.getElementsByTagName('h2')[0];
obj.style.bottom="-50px";
var change=function(){
var obj_h=parseInt(obj.style.bottom);
if(obj_h<0){obj.style.bottom=(obj_h+Math.floor((0-obj_h)*0.1))+"px"}//if
else{clearInterval(t)}
}
var back=function(){
var obj_hh=parseInt(obj.style.bottom);
if(obj_hh>-50){obj.style.bottom=(obj_hh+Math.floor((-50-obj_hh)*0.1))+"px"}
else{clearInterval(tt)}
}
_div.onmouseover=function(){clearInterval(tt);t=setInterval(change,10);}
_div.onmouseout=function(){clearInterval(t);tt=setInterval(back,10)}
}
window.onload=function(){
go();
}
</script>
</head>
<body>
<div id="show">
<h2>北国南疆,风光无限</h2>
<img src="wall2.jpg" />
</div>
</body>
</html>
相关文章推荐
- 鼠标滑过,缩略图放大显示(纯CSS)
- 强大的sscanf函数
- jenkins服务构建
- c3p0、dbcp和proxool比较
- 平滑图片滚动
- 前后轮翻的JS图片幻灯切换
- 清爽简洁的图片交替导航效果
- 利用html5、websocket和opencv实现人脸检测
- UVA 1619/POJ2796 滑窗算法/维护一个单调栈
- C# winsocket连接 Jsonp
- python 使用lxml解析html(xpath)
- WEB服务器、应用程序服务器、HTTP服务器区别(基础普及)
- 练习32——循环和列表
- ListView 节头制作
- 马赛克效果的JS图片切换代码
- 美化过的匀速图片滚动
- linux 下 修改mysql账号密码
- mysql timeout connection
- web.xml is missing and <failOnMissingWebXml> is se
- ajax send()