本文實(shí)例講述了js實(shí)現(xiàn)拉幕效果的廣告代碼。分享給大家供大家參考。具體如下:
這是一款拉幕效果的廣告代碼,廣告圖片像窗簾的幕布一樣慢慢的被拉上去了,縮小至一定大小后定格,目前來說,在一些大型的門戶網(wǎng)站中仍然可以見到這種效果。
運(yùn)行效果截圖如下:

在線演示地址如下:
http://demo.VeVB.COm/js/2015/js-lm-style-adv-pic-style-codes/
具體代碼如下:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>slide</title><style type="text/css"> html,body{ width:100%; height:100%; margin:0px; border:0px; text-align:center;}div{ margin:auto; overflow:hidden;}</style></head><body><script type="text/javascript"> function tag(obj){ return document.getElementsByTagName(obj)[0];}window.onload=function(){ setTimeout("slideUp();",1000);}function slideUp(){ if(tag("div").offsetHeight>0){  if(tag("div").offsetHeight>10){   tag("div").style.height=tag("div").offsetHeight-10+"px"   setTimeout("slideUp();",20);  }else{   tag("div").style.display="none";   tag("img").src="images/wall8.jpg";   tag("div").style.display="block";   slideDown();  } }}function slideDown(){ if(tag("div").offsetHeight<80){  if(tag("div").offsetHeight<70){   tag("div").style.height=tag("div").offsetHeight+10+"px";   setTimeout("slideDown();",20);  }else{   tag("div").style.height="80px";  } }}</script><div><img src="images/wall8.jpg"></div></body></html>希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注