演示代码:
测试
.divCss{
bottom:0;
display:block;
height:25px;
overflow:hidden;
padding:0;
position:fixed;
right:20px;
}
.contentCss{
background:#666;
height:200px;
width:200px;
}
.contentCssHeight{
}
.titleCss{
width:200px;
height:25px;
line-height:25px;
text-align:right;
margin:0px;
background:#999999;
}
#close{
cursor:pointer;
}
测试Div
打开
这是一些测试内容
测试Div
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]核心代码:复制代码 代码如下:$(function(){ //标题层的高度--提示打开或关闭 var titHeight=$("#ditTitle").height(); //内容层的高度 var conHeight=$("#divContent").height(); //打开或关闭 $("#close").toggle(function(){ //改变提示 $("#close").text("关闭"); //动画--一秒内消息层高度增加,top增加 $("#msgDiv").animate({height:titHeight+conHeight},1000,function(){ //展开后执行的函数 }); },function(){ //改变提示 $("#close").text("打开"); //alert(temp+" "+titHeight); $("#msgDiv").animate({height:titHeight},1000,function(){ //关闭后执行的函数 }); }) //执行 var myTimer,i=8; function starFun() { //触发click事件,显示 if(i==4) { $("#close").click(); } //清除timeout,触发click事件,关闭层 if(i==0) { window.clearTimeout(myTimer); if($("#close").text()!="打开") $("#close").click(); } myTimer=window.setTimeout(starFun,1000); i=i-1; } starFun() });经测试IE6不可运行,鉴于当前使用IE6的中国用户比较多,建议大家学习,不建议使用。
推荐阅读
Firebug入门指南(Firefox浏览器)
我最近就在学习怎么使用Firebug,网上找到一篇针对初学者的教程,感觉比较有用,就翻译了出来。
作者:Estelle Weyl
原文网址:http://www.evotech.net/blog/2007/06/introduction-to-firebug/
译者:>>>详细阅读
本文标题:基于jQuery的网页右下角弹出广告(IE7,firefox)
地址:http://www.17bianji.com/kaifa2/JS/25806.html
1/2 1