常用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 ...
随机推荐
- django-rest-framework之基于类的视图
前言:上一篇博客中,主要讲的是请求和响应,项目里面views.py中的视图函数都是基于函数的,并且我们介绍了@api_view这个很有用的装饰器.同时,我们还介绍了APIView这个类,但是还没使用它 ...
- C++ 内存分配(new,operator new)面面观 (转)
本文主要讲述C++ new运算符和operator new, placement new之间的种种关联,new的底层实现,以及operator new的重载和一些在内存池,STL中的应用. 一 new ...
- 使用scrapy爬取豆瓣上面《战狼2》影评
这几天一直在学习scrapy框架,刚好学到了CrawlSpider和Rule的搭配使用,就想着要搞点事情练练手!!! 信息提取 算了,由于爬虫运行了好几次,太过分了,被封IP了,就不具体分析了,附上& ...
- Linux系统下LNMP一键搭建Linux、PHP、MySQL环境(适合新手搭建linux下的web生成环境)
一. 首先要解释一下,什么是LNMP,LNMP起源于LAMP,LAMP是Linux+Apache+Mysql/MariaDB+Perl/PHP/Python的缩写,这里将Web服务端的Apache替换 ...
- 处理springMvc中responsebody返回中文乱码
法一: @RequestMapping(value="/getUsersByPage",produces = public String getUsers 法二:在sprin ...
- Win7 64位操作系统中搭建C/C++的编译环境
通常使用IDE工具为 VS2010 .但是如果仅仅只是想在Windows中使用命令行对C/C++源码进行编译和运行.则需要使用 CL 命令方式或另外安装 Cygwin / MinWin 命令行编译器. ...
- centos7时间同步
用ntpdate从时间服务器更新时间 1.如果你的linux系统根本没有ntpdate这个命令 yum install -y ntp 2.安装完了之后,你不要做什么配置,也不需要,直接测试一下 [ro ...
- MyEclipse出现红色感叹号解决办法
今天在做数据库连接练习的时候自己创建的工程突然出现了一个红色的感叹号,然后运行自己写的代码的时候出现找不到主类的错误!!! 我还以为是自己不小心写错了,然后让编译器自动生成代码也出现了一样的问题... ...
- 三、scrapy后续
CrawlSpiders 通过下面的命令可以快速创建 CrawlSpider模板 的代码: scrapy genspider -t crawl tencent tencent.com 我们通过正则表达 ...
- Linux系统软件安装的几种方式
Linux系统,一个文件能不能执行看的是有没有可执行权限x,不过真正的可执行文件是二进制文件(binary file),举例来说Linux上的c语言源码编写完后,通过gcc程序编译后就可以创建一个可执 ...