javascript 模拟京东关闭广告栏
2024-10-19 04:34:03
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.site-nav {
height: 30px;
background-color: #ccc;
}
.top-banner {
background-color: orange;
}
.w {
width: 1200px;
height: 80px;
background-color: pink;
margin: 0 auto;
position: relative;
}
.search {
width: 1200px;
height: 80px;
background-color: lemonchiffon;
margin: 0 auto;
}
a {
position: absolute;
top: 10px;
right: 10px;
width: 25px;
height: 25px;
text-align: center;
line-height: 25px;
background-color: #000;
color: #fff;
text-decoration: none; }
</style>
</head>
<body>
<div class="site-nav"></div>
<div class="top-banner" style="opacity: 1">
<div class="w">
<a href="#">×</a>
</div>
</div>
<div class="search"></div> <script>
//获取事件源
var topBanner = document.getElementsByClassName("top-banner")[0];
var a = topBanner.children[0].firstElementChild || topBanner.children[0].firstChild;
//定义定时器
var timer = null;
a.onclick = function(){
timer = setInterval(function(){
topBanner.style.opacity -=.1;
if (topBanner.style.opacity < 0) {
topBanner.style.display = "none";
clearInterval(timer);
}
},50);
}
</script> </body>
</html>
最新文章
- windows下mysql数据库定时备份。
- 简单测试nginx1.90做TCP协议负载均衡的功能
- 【python】类的继承和多态
- SQL Server 查看物理页存储
- SpringMVC上传文件
- UITableView全面解析,讲的好详细
- type tips
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- 【Tools】maven安装
- 用c语言程序对显存进行操作
- CVE-2014-0196(马拉松赛跑bug)
- Apache+Subversion+TortoiseSVN
- VBS基础篇 - 对象(3) - FileSystemObject对象
- Java(基础)的类与变量
- JAVA中接口的使用
- web 11
- C#、winform、wpf将类控件放进工具箱里
- linux下用户操作
- 目标检测(二) SPPNet
- WKWebView使用方法
热门文章
- tensorflow在windows下的安装
- 我的集合学习笔记--LinkedList
- js十大排序算法:冒泡排序
- JVM EXCEPTION_ACCESS_VIOLATION
- win10总是2分钟就自动睡眠怎么办 win10系统自动休眠bug怎么解决(转)
- reshape、shuffle、save_weights
- 使用Java HttpComponent/HttpClinet 调用 WebAPI问题的解决
- int ,Intege,String 三者之间的转换
- 如果filename的value有值 说明支持存储
- map内置函数分析所得到的思路