常用UI模板,loading框,提醒框,弹框确认框
css部分
#public_box{width:100%;height:100%;position:fixed;top:0;left:0;z-index:100;background:rgba(0,0,0,.4);}
.spinner {
margin:-17px -75px;
width: 150px;
position:absolute;
top:50%;
left:50%;
text-align: center;
}
.spinner > div {
width: 30px;
height: 30px;
background-color: #1A1A1A;
border-radius: 100%;
display: inline-block;
-webkit-animation: bouncedelay 1.4s infinite ease-in-out;
animation: bouncedelay 1.4s infinite ease-in-out;
/* Prevent first frame from flickering when animation starts */
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
@-webkit-keyframes bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0.0) }
40% { -webkit-transform: scale(1.0) }
}
@keyframes bouncedelay {
0%, 80%, 100% {
transform: scale(0.0);
-webkit-transform: scale(0.0);
} 40% {
transform: scale(1.0);
-webkit-transform: scale(1.0);
}
}
/*remind*/
#remindBg{width:100%;position:fixed;bottom:90px;left:0;animation:moveRemind linear 0.6s;z-index:999;display:flex;justify-content:center;align-items:center;}
#remindBg #remindBox{max-width:70%;min-width:30%;line-height:16px;font-size:14px;padding:10px 15px;background:rgba(0,0,0,.7);color:white;border-radius:4px;text-align:center;}
@keyframes moveRemind{
0%{bottom:0;opacity:0;transform:scale(0.6);}
40%{bottom:90px;opacity:0.3;transform:scale(1.2);}
100%{bottom:90px;opacity:1;transform:scale(1);}
}
@-webkit-keyframes moveRemind{
0%{bottom:0;opacity:0;transform:scale(0.6);}
40%{bottom:90px;opacity:0.3;transform:scale(1.2);}
100%{bottom:90px;opacity:1;transform:scale(1);}
}
/*查看更多的按钮*/
.lookbtn{width:100%;height:44px;text-align:center;line-height:44px;font-size:12px;color:#1A1A1A;box-shadow:0px -2px 10px #E5E5E5;}
/*弹框样式*/
#bounces_bg{width:100%;height:100%;position:fixed;z-index:90;top:0;left:0;display:flex;justify-content:center;align-items:center;display:-webkit-flex;-webkit-justify-content:center;-webkit-align-items:center;background:rgba(51,51,51,.4);}
#bounces_bg .bounces_box{width:280px;border-radius:10px;background:white;font-size:16px;color:#1A1A1A;line-height:24px;text-align:center;-webkit-animation:bouncesMove .4s ease;animation:bouncesMove .4s ease;}
#bounces_bg .bounces_box .bounces_title{width:240px;padding:30px 20px;overflow:hidden;}
#bounces_bg .bounces_box .bounces_btn{width:100%;height:40px;border-top:1px solid #E5E5E5;display:flex;justify-content:space-between;align-items:center;display:-webkit-flex;-webkit-justify-content:space-between;-webkit-align-items:center;}
#bounces_bg .bounces_box .bounces_btn .bounces_off,#bounces_bg .bounces_box .bounces_btn .bounces_on{width:50%;height:40px;line-height:40px;position:relative;top:0;left:0;}
#bounces_bg .bounces_box .bounces_btn .bounces_on:after{content:'';width:1px;height:40px;position:absolute;left:0;top:0;background:#E5E5E5;}
@keyframes bouncesMove {
0%{
opacity:0;
transform:translateX(-100%);
-webkit-transform: translateX(-100%);
}
75% {
opacity:.75;
transform: translateX(30%);
-webkit-transform: translateX(30%);
}
100% {
opacity:1;
transform: translateX(0);
-webkit-transform: translateX(0);
}
}
js部分
function Publicfun(){
this.loading=function(){
//创建div标签
var public_box=document.createElement('div');
var str='<div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>';
public_box.id="public_box";
public_box.innerHTML=str;
//将新的div标签插入到页面
document.documentElement.appendChild(public_box);
//页面滑动事件阻止
public_box.ontouchmove=function(e){
e.preventDefault();
}
},
this.hideLoad=function(){
setTimeout(function(){
document.documentElement.removeChild(document.getElementById('public_box'))
},300);
},
this.remind=function(title){
var remindBg=document.createElement('div');
var str='<div id="remindBox">'+title+'</div>';
remindBg.id="remindBg";
remindBg.innerHTML=str;
//插入标签
document.documentElement.appendChild(remindBg);
setTimeout(function(){
document.documentElement.removeChild(remindBg)
},1000);
},
//弹框确认模板按钮
this.bounces=function(title,show){
//创建模板框
var bounces=document.createElement('div');
var str='<div id="bounces_bg"><div class="bounces_box"><div class="bounces_title">'+title+'</div><div class="bounces_btn"><div id="close_bounces_box" class="bounces_off">取消</div><div id="bounces_on_btn" class="bounces_on">确认</div></div></div></div>';
bounces.id="bounces_bg";
//插入模板布局
bounces.innerHTML=str;
//插入标签
document.documentElement.appendChild(bounces);
//点击取消按钮
document.getElementById('close_bounces_box').onclick=function(){
document.documentElement.removeChild(bounces);
};
//点击确认按钮
document.getElementById('bounces_on_btn').onclick=function(){
//执行回调函数
show();
//清除弹框
document.documentElement.removeChild(bounces);
}
//页面滑动事件阻止
bounces.ontouchmove=function(e){
e.preventDefault();
}
}
}
var publicFun=new Publicfun();
常用UI模板,loading框,提醒框,弹框确认框的更多相关文章
- [转]js中confirm实现执行操作前弹出确认框的方法
原文地址:http://www.jb51.net/article/56986.htm 本文实例讲述了js中confirm实现执行操作前弹出确认框的方法.分享给大家供大家参考.具体实现方法如下: 现在在 ...
- C# GridView Edit & Delete, 点击Delete的时候弹出确认框
1. 使用GridView自带属性ShowEditButton和ShowDeleteButton,均设为True <Columns> ... <asp:CommandField S ...
- 请写出一段JavaScript代码,要求页面有一个按钮,点击按钮弹出确认框。程序可以判断出用
请写出一段JavaScript代码,要求页面有一个按钮,点击按钮弹出确认框.程序可以判断出用 户点击的是“确认”还是“取消”. 解答: <HTML> <HEAD> <TI ...
- 【Vue | ElementUI】Vue离开当前页面时弹出确认框实现
Vue离开当前页面时弹出确认框实现 1. 实现目的 在某种业务场景下,用户不允许跳转到其他页面.于是,需要在用户误操作或者是点击浏览器跳转时提示用户. 2. 实现原理 使用路由守卫beforeRout ...
- bootstrap模态框动态赋值, ajax异步请求数据后给id为queryInfo的模态框赋值并弹出模态框(JS)
/查询单个 function query(id) { $.ajax({ url : "/small/productServlet", async : true, type : &q ...
- GridView控件中插入自定义删除按钮并弹出确认框
GridView控件中插入自定义删除按钮,要实现这个功能其实有多种方法,这里先记下我使用的方法,以后再添加其他方法. 一.实现步骤 1.在GridView中添加模板列(TemplateField). ...
- js弹出确认框,挺全
一种: <a href="javascript:if(confirm('确实要删除该内容吗?'))location='http://www.google.com'">弹 ...
- 在“BindingNavigator”删除数据前弹出确认框的实现
1)先设置DeleteItem为空,不让它调用自动生成的删除代码. 2)然后自己写代码实现,如下: private void bindingNavigatorDeleteItem_Click(obje ...
- Js 删除前弹出确认框
<td align="center" valign="middle" class="black3"> <c:if test ...
随机推荐
- BZOJ 3994: [SDOI2015]约数个数和 [莫比乌斯反演 转化]
2015 题意:\(d(i)\)为i的约数个数,求\(\sum\limits_{i=1}^n \sum\limits_{j=1}^m d(ij)\) \(ij\)都爆int了.... 一开始想容斥一下 ...
- 【WC2013】糖果公园 [树上莫队]
题意: 一棵树,修改一个点的颜色,询问两点路径上每种颜色的权值$val[c]$*出现次数的权值$cou[w[c]]$的和 sro VFK 树上莫队 按照王室联邦的方法分块,块的大小直径个数有保证,并不 ...
- BZOJ 1119: [POI2009]SLO [置换群]
传送门:现在$POI$上的题洛谷都有了,还要$BZOJ$干什么 和$cow\ sorting$一样,只不过问$a_i \rightarrow b_i$ 注意置换是位置而不是数值...也就是说要$i$的 ...
- vue2.0 组织机构树形选择组件(类似elementui <el-transfer> 与 <el-tree> 两个标签的结合)
1. 效果图 2. 实现: 三级(部门或人员的树形选择) 3. 模拟数据说明: fake.js name: 显示的名称(同时也是源码中 for 循环单一的key , 如果真实数据存在名字有重 ...
- 引用MinGW生成的.dll.a后出现的问题
以前很少调用MinGW的运行时库,现在用到一个项目,用到了glib和gettext等. 遇到了一个问题,折腾了一个下午. gettext的运行时库之一是intl,MinGW只提供了.dll.a,于是参 ...
- WPF ”真正的“高仿QQ
时常可以在各种论坛 博客 看到 各种所谓的 高仿QQ. 说实话 越看越想笑呢.(PS:纯粹的 抨击 那些 不追求 UI 完美主义者) 例如: 本次模仿 采用 C# WPF XAML , 总 ...
- 940D Alena And The Heater
传送门 题目大意 给出两个长度为N的数组A,B,以及一种计算规律: 若t[i]=1,需满足t[i-1]=t[i-2]=t[i-3]=t[i-4]=0,以及max{A[i],A[i-1],A[i-2], ...
- Pycharm常用的使用方法
PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Project管理.代码跳转.智能提示.自动完成.单元测试.版本控制. ...
- C# 13行代码带你模拟登录QQ空间
最近想做一个QQ空间点赞的小工具,于是晚上下班回来就开始分析PC版的QQ空间,打开Chrome,切换到Network,然后输入账号密码,然后点击登录... 然后,我曹....一堆请求就开始了....搞 ...
- GCD实现倒计时
之前面试中,好多面试官,问使用GCD如何实现倒计时,我当时也没写过,所以一时不知道怎么说,所以结束之后,我实现一下GCD的倒计时. - (void)startTime:(UIButton *)send ...