慢慢展开再慢慢收起的javascript广告效果
我们 效果代码
*{margin:0;padding:0;}
body {height:2000px;}
#menu {
width:220px;
height:420px;
position:absolute;
z-index:1000;
background:url(/upload/20080421090108362.gif) repeat-x top left;
}
#menu_h {
float:right;
}
#menu_h img {
cursor:pointer;
}
#menu_c {
width:188px;
height:398px;
border:1px solid #666;
background:#ecf6f5;
margin:12px 0 0 5px;
}
#menu_c h2 {
text-align:center;
}
var time = 300;
var h = 0;
function addCount()
{
if(time>0)
{
time--;
h = h+5;
}
else
{
return;
}
if(h>300) //高度
{
return;
}
document.getElementById("ads").style.display = "";
document.getElementById("ads").style.height = h+"px";
setTimeout("addCount()",30);
}
window.onload = function showAds()
{
addCount();
setTimeout("noneAds()",7000); //停留时间自己调了
}
var T = 300;
var N = 300; //高度
function noneAds()
{
if(T>0)
{
T--;
N = N-5;
}
else
{
return;
}
if(N
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]