打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
鼠标放到图片上会滑出提示文字
鼠标放到图片上会滑出提示文字,不用多介绍了,运行一下就知道效果了。
 
<!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="/jscss/demoimg/wall2.jpg" />
</div>
</body>
</html>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
关于两侧掛件
用“美图秀秀”在图片上删·加文字简单实用
js setInterval() 方法
原生JS实现匀速图片轮播动画
【原创】关于图片切换的制作方法 [论坛存档]
利用图片当提示?Excel里面这2种数据提示的方法,简单却有大用处
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服