首页 > 其他 > 详细

卷帘效果

时间:2015-07-09 17:43:05      阅读:99      评论:0      收藏:0      [点我收藏+]

<head>
<title>卷帘效果</title>
</head>
<body>
<input id="shen" type="button" value="展开">
<input id="shou" type="button" value="收起">
<div id="wind" style="background-color:#bbbbbb;width:200px;height:1px;">
</div>
<script type="text/javascript">
//控制展开的旗标
var shenflag=true;
var shouflag = false;
function shen(){
if(shenflag){
shouflag=false;
var tm;
var windHeight=document.getElementById("wind").style.height;
if(parseInt(windHeight.substring(0,windHeight.indexOf("px")))<100){
document.getElementById("wind").style.height=
parseInt(windHeight.substring(0,windHeight.indexOf("px")))+2+"px";
tm = setTimeout("shen()",50);
}else{
clearTimeout(tm);
shouflag = true;
}
}
}
function shou(){
if(shouflag){
shenflag=false;
var tm;
var windHeight=document.getElementById("wind").style.height;
if(parseInt(windHeight.substring(0,windHeight.indexOf("px")))>3){
document.getElementById("wind").style.height=
parseInt(windHeight.substring(0,windHeight.indexOf("px")))-2+"px";
tm = setTimeout("shou()",50);
}else{
clearTimeout(tm);
shouflag = true;
}

}
}
document.getElementById("shen").onclick=shen;
document.getElementById("shou").onclick=shou;
</script>
</body>

卷帘效果

原文:http://www.cnblogs.com/my-king/p/4633617.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!