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框,提醒框,弹框确认框的更多相关文章

  1. [转]js中confirm实现执行操作前弹出确认框的方法

    原文地址:http://www.jb51.net/article/56986.htm 本文实例讲述了js中confirm实现执行操作前弹出确认框的方法.分享给大家供大家参考.具体实现方法如下: 现在在 ...

  2. C# GridView Edit & Delete, 点击Delete的时候弹出确认框

    1. 使用GridView自带属性ShowEditButton和ShowDeleteButton,均设为True  <Columns> ... <asp:CommandField S ...

  3. 请写出一段JavaScript代码,要求页面有一个按钮,点击按钮弹出确认框。程序可以判断出用

    请写出一段JavaScript代码,要求页面有一个按钮,点击按钮弹出确认框.程序可以判断出用 户点击的是“确认”还是“取消”. 解答: <HTML> <HEAD> <TI ...

  4. 【Vue | ElementUI】Vue离开当前页面时弹出确认框实现

    Vue离开当前页面时弹出确认框实现 1. 实现目的 在某种业务场景下,用户不允许跳转到其他页面.于是,需要在用户误操作或者是点击浏览器跳转时提示用户. 2. 实现原理 使用路由守卫beforeRout ...

  5. bootstrap模态框动态赋值, ajax异步请求数据后给id为queryInfo的模态框赋值并弹出模态框(JS)

    /查询单个 function query(id) { $.ajax({ url : "/small/productServlet", async : true, type : &q ...

  6. GridView控件中插入自定义删除按钮并弹出确认框

    GridView控件中插入自定义删除按钮,要实现这个功能其实有多种方法,这里先记下我使用的方法,以后再添加其他方法. 一.实现步骤 1.在GridView中添加模板列(TemplateField). ...

  7. js弹出确认框,挺全

    一种: <a href="javascript:if(confirm('确实要删除该内容吗?'))location='http://www.google.com'">弹 ...

  8. 在“BindingNavigator”删除数据前弹出确认框的实现

    1)先设置DeleteItem为空,不让它调用自动生成的删除代码. 2)然后自己写代码实现,如下: private void bindingNavigatorDeleteItem_Click(obje ...

  9. Js 删除前弹出确认框

    <td align="center" valign="middle" class="black3"> <c:if test ...

随机推荐

  1. xBIM 日志操作

    目录 xBIM 应用与学习 (一) xBIM 应用与学习 (二) xBIM 基本的模型操作 xBIM 日志操作 XBIM 3D 墙壁案例 xBIM 格式之间转换 xBIM 使用Linq 来优化查询 x ...

  2. BZOJ 2683: 简单题 [CDQ分治]

    同上题 那你为什么又发一个? 因为我用另一种写法又写了一遍... 不用排序,$CDQ$分治的时候归并排序 快了1000ms... #include <iostream> #include ...

  3. 通过WMI获取机器信息

    PerformanceCounter的介绍就不多说了,MSDN上介绍的很详细: https://msdn.microsoft.com/zh-cn/library/system.diagnostics. ...

  4. 随机手机号和身份证号码(python)

    在使用selenium2 python自动化过程中,用户添加的时候程序设置的手机号和身份证号码是唯一的,这方面python代码可以实现,以下是调试成功,可以实现的. 具体代码如下 身份证需要下载dis ...

  5. Jetty容器

    ♣Jetty和Tomcat的区别 ♣Jetty下载.安装 ♣eclipse安装jetty插件 ♣第一个jetty测试(maven+jetty) 1.Jetty和Tomcat的区别   Jetty 是一 ...

  6. CodeForces 586D

    题意略. 将人的移动分为3步,第一步向右,第二步是行之间的变换,第三步是向右走2步,三步加在一起算作是一次移动,计入判重数组. 在第一步时有一个特殊情况:已经越过最右边的边界线,这时graph[x][ ...

  7. 前端构建工具之gulp的安装和配置

    在选择构建工具时,看到更多人推荐gulp,从此入了gulp的坑- 一.安装node环境 百度谷歌一下就有了,在终端中分别输入 node -v 和 npm -v,若显示node和npm的版本号则说明no ...

  8. 新人学习selenium哪些资源比较有帮助?

    为什么学习selenium? selenium现在基本上成了页面自动化测试的标配,具体理由我在selenium 3.0发布这篇文章里已经说明过了.当一个东西成为标准以后,那么它的能量和潜力都是巨大的. ...

  9. 终极解决方案:java.security.cert.CertificateException: Certificates does not conform to algorithm constraints

    报错信息 javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does ...

  10. python数据可视化学习1

    import matplotlib.pyplot as plt input_values = [1,2,3,4,5] #输入值 squares = [1,4,9,16,25] #输出值 plt.plo ...