博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小广告效果
阅读量:4596 次
发布时间:2019-06-09

本文共 2009 字,大约阅读时间需要 6 分钟。

<!doctype html>

<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
font-size: 14px;
box-sizing:border-box;
}
body{
background: url(http://joymepic.joyme.com/article/uploads/allimg/201511/1448602825502582.gif);
}
#ad{
height: 250px;
width: 350px;
border: solid 1px #aaa;
position: fixed;
right: 0;
bottom: -250px;
}
#close{
position: absolute;
right: 20px;
top: 10px;
cursor: pointer;
display: block;
height: 20px;
width: 20px;
text-align: center;
line-height: 20px;
background: #000;
color: #fff;
}
p:first-of-type{
width: 100%;
line-height: 40px;
height: 40px;
background: #0aa;
position: absolute;
top: 0;
left: 0;
padding-left: 20px;
}
p:first-of-type>span:first-of-type{
font-weight: bold;
}
textarea{
position: absolute;
left: 0;
top: 40px;
width: 350px;
height: 170px;
border: none;
}
p:last-of-type{
width: 100%;
line-height: 40px;
height: 40px;
background: #0aa;
position: absolute;
bottom: 0;
left: 0;
}
p:last-of-type>input{
position: absolute;
right: 20px;
top: 10px;
}
</style>
</head>
<body>
<div id="ad">
<p>
<span>请注意</span>
<span id="close">x</span>
</p>
<div>
<textarea></textarea>
</div>
<p>
<input type="submit">
</p>
</div>
<script type="text/javascript">
var oad = document.getElementById('ad');
var close = document.getElementById('close');
var timer1,timer2;
var count=-250;

// 弹出广告

function up(){
clearInterval(timer1);
timer1 = setInterval(function(){
count++;
oad["style"]["bottom"] = count+"px";
if(count == 0){
window.clearInterval(timer1);
}
},5);
}

function down() {

timer2 = setInterval(function(){
count--;
oad["style"]["bottom"] = count+"px";
if(count == -250){
clearInterval(timer2);
setTimeout(function(){
timer1 = setInterval(function(){
count++;
oad["style"]["bottom"] = count+"px";
if(count == 0){
window.clearInterval(timer1);
}
},5);
},3000);
}
},5);
}
window.onload = up;
close.onclick = down;

</script>
</body>
</html>

 

WEB前端学习交流群21 598399936

 

转载于:https://www.cnblogs.com/luludehuhuan/p/8149029.html

你可能感兴趣的文章
JavaScript对象
查看>>
IIS7(Windows7)下最简单最强安装多版本PHP支持环境
查看>>
关于Cocos2d-x发布游戏的时候遇到的问题和解决
查看>>
CSS学习笔记之样式声明
查看>>
rtmpdump代码分析 转
查看>>
codeforces #322 div 2 D. Three Logos (枚举)
查看>>
20145202马超《JAVA》预备作业1
查看>>
[导入]参考OpenSceneGraph的3ds插件学习lib3ds
查看>>
java基础-四大特征
查看>>
linux文档查看器
查看>>
如何使用 ccs7.2调试代码
查看>>
2016.8.22 Axure两级下拉框联动的实现
查看>>
C#集合类:动态数组、队列、栈、哈希表、字典(转)
查看>>
基于bootstrap 的datatable插件的使用(php版)
查看>>
展示图片的自动和手动切换
查看>>
机器学习分类
查看>>
kvm虚拟化关闭虚拟网卡virbr0的方法
查看>>
课后作业1
查看>>
深入HashMap
查看>>
JavaScript中模块化工具require.js
查看>>