[CSS+HTML] 一个Banner广告收缩效果
2014-08-23 01:47:20 -0400
代码复制
<style type="text/css"> *{margin:0; padding:0;} #main{margin:0 auto; width:100px;} #banner{display:none; margin:0 auto; width:960px; height:160px; background:url(http://www.codefans.net/jscss/demoimg/201107/banner.png) no-repeat; position:relative;} #close{display:block; width:50px; height:22px; text-align:center; line-height:22px; border:1px #ddd solid; background:#000; color:#fff; font-size:12px; float:right; cursor:pointer;} </style> <script type="text/javascript" src="http://www.codefans.net/ajaxjs/jquery1.3.2.js"></script> <script type="text/javascript"> $ ( function() { $("#banner").slideDown(); var Up=function(){$("#banner").slideUp(1500)} setTimeout(Up,3000); $("#close").click ( function() { $("#banner").slideToggle ( 600,function() { if($("#banner").css("display") == "none") { $("#close").text("打开"); } else { $("#close").text("关闭"); } } ); } ); } ); </script> </head> <body> <div id="main"> <div id="banner">X6.WODEMO.NET</div> <span id="close">关闭</span> </div> </body> </html>
代码演示
X6.WODEMO.NET
关闭
«Newer
Older»
Comment:
Name:
Back to home
Subscribe
|
Register
|
Login
|
N