代码简介:
鼠标放到图片上会滑出提示文字,不用多介绍了,运行一下就知道效果了。
代码内容:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
<!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>鼠标放到图片上会滑出提示文字代码_网页代码站(www.webdm.cn)</title>
<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.οnmοuseοver=function(){clearInterval(tt) ; t=setInterval(change,10);}
_div.οnmοuseοut=function(){clearInterval(t) ; tt=setInterval(back,10)}
}
window.οnlοad=function(){
go() ;
}
</script>
</head>
<body>
< div id= " show " >
<h2>北国南疆,风光无限</h2>
<img src= " http://www.webdm.cn/images/wall2.jpg " />
</ div >
</body>
</html>
<br />
<p><a href= " http://www.webdm.cn " >网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>
代码来自: http: //www.webdm.cn/webcode/a3408124-5a87-476a-83bc-b3b326066d86.html
<html xmlns= " http://www.w3.org/1999/xhtml " >
<head>
<title>鼠标放到图片上会滑出提示文字代码_网页代码站(www.webdm.cn)</title>
<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.οnmοuseοver=function(){clearInterval(tt) ; t=setInterval(change,10);}
_div.οnmοuseοut=function(){clearInterval(t) ; tt=setInterval(back,10)}
}
window.οnlοad=function(){
go() ;
}
</script>
</head>
<body>
< div id= " show " >
<h2>北国南疆,风光无限</h2>
<img src= " http://www.webdm.cn/images/wall2.jpg " />
</ div >
</body>
</html>
<br />
<p><a href= " http://www.webdm.cn " >网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>
代码来自: http: //www.webdm.cn/webcode/a3408124-5a87-476a-83bc-b3b326066d86.html