实用顶部固定位置悬浮图层效果

2个月前 (03-01 23:04)阅读52回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4189
  • 级别管理员
  • 主题837
  • 回复2
楼主

网页顶部图层悬浮定位显示特效,常常用于网站顶部广告,可自己添加一个关闭按钮,或者修改图层大小。

<!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">
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>实用顶部固定位置悬浮图层效果_武鸣人</title>
<style type="text/css">
*{margin:0;padding:0;}
ul,li{list-style:none;}
#wuming_rem{width:600px;margin:50 50 50 50;border:1px solid #f00;}
ul li.item{width:400px;text-align:center;margin:20px 100px;background:#00f;color:#fff;font-size:14px;font-weight:bold;height:100px;line-height:100px;}
#www_wuming_ren{position:absolute;top:0;left:50%;width:900px;margin-left:-450px;height:30px;line-height:30px;text-align:center;background:#000;color:#fff;font-size:14px;font-weight:bold;z-index:2;}
</style>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div id="www_wuming_ren">努力是一种状态,与年龄无关,越努力越幸运,越自律越优秀,所有优秀背后都是苦行僧般的自律。</div>
<ul id="wuming_rem">
<li class="item">武鸣人一号内容</li>
<li class="item">武鸣人二号内容</li>
<li class="item">武鸣人三号内容</li>
<li class="item">武鸣人四号内容</li>
<li class="item">武鸣人五号内容</li>
<li class="item">武鸣人六号内容</li>
<li class="item">武鸣人七号内容</li>
<li class="item">武鸣人八号内容</li>
<li class="item">武鸣人九号内容</li>
<li class="item">武鸣人十号内容</li>
</ul>
<script language="javascript">
var speed = 100;
var scrollTop = null;
var hold = 0;
var float_banner;
var pos = null;
var timer = null;
var moveHeight = null;
float_banner = document.getElementById("www_wuming_ren");
window.onscroll=scroll_ad;
function scroll_ad(){
scrollTop = document.documentElement.scrollTop+document.body.scrollTop;
pos = scrollTop - float_banner.offsetTop;
pos = pos/10
moveHeight = pos>0?Math.ceil(pos):Math.floor(pos);
if(moveHeight!=0){
float_banner.style.top = float_banner.offsetTop+moveHeight+"px";
setTimeout(scroll_ad,speed);
}
//alert(scrollTop);
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
</body>
</html>


0
0
收藏0
回帖

实用顶部固定位置悬浮图层效果 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息