87,910
社区成员
发帖
与我相关
我的任务
分享
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网页上从右边缓缓弹出的广告框效果</title>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script language="javascript">
function popBox(id,closeid)
{
$("#"+id).animate({right:"0px"},"normal",function(){$("#"+closeid).attr("class","close"). text('-')});
}
function closeBox(id,closeid)
{
$("#"+id).animate({right:(-($("#"+id).width()-$("#"+closeid).width()))+"px"},"normal",function(){$("#"+closeid).attr("class","open").text('+')});
}
window.onload=function()
{
$("#kong").height($("#abc").outerHeight());
$("#tit").click(
function()
{
if
($(this).attr('class')=="open") popBox('abc','tit')
else closeBox('abc','tit');
});
window.setTimeout("popBox('abc','tit')",1000);
}
</script>
<style type="text/css">
<!--
#abc {
border: 1px solid #fff;
position:absolute; /* position:relative; */
height: 150px;
width: 220px;
right:-100%;
background-color:red;
}
#abc #tit {
background-color: #0066FF;
position: relative;
height: 100%;
width: 20px;
color: #FFFFFF;
text-align: center;
float: left;
}
#kong {
background-color:yellow;
position:relative;
width: 100%;
top: 100px;
right: 0px;
overflow:hidden;
}
.right {
float: right;
width: 190px;
padding: 5px;
}
-->
</style>
</head>
<body style="margin:0px;">
<div id="kong">
<!--浮动框-->
<div id="abc">
<div id="tit" class="close">-</div>
<div class="right">
<a href="#">网页上从右边缓缓弹出的广告框效果</a></div>
</div>
</div>
<h1>1秒后弹出!!!</h1>
</body>
</html>