Bootstrap Modal 框 alert confirm loading
/**
* Created by Administrator on 2016/5/4.
*/
/**
* 模态窗口
*/
window.Modal = {
tpls:{
alert:'<div class="modal fade" tabindex="-1" role="dialog"><div class="modal-dialog modal-sm" role="document" style="margin-top: 20%;"><div class="modal-content"><div class="modal-header" style="padding: 8px 15px;"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title">系统提示</h4></div><div class="modal-body"><p class="message-box text-center"></p></div></div></div></div>',
confirm:'<div class="modal fade"><div class="modal-dialog modal-sm" role="document" style="margin-top: 20%;"><div class="modal-content"><div class="modal-header" style="padding: 8px 15px;"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title">系统提示</h4></div><div class="modal-body"><p class="message-box text-center"></p></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">取消</button><button type="button" class="btn btn-primary">确定</button></div></div></div></div>',
loading:'<div class="modal fade"><div class="modal-dialog modal-sm" role="document" style="margin-top: 20%;"><div class="modal-content" style="box-shadow: none;border: none;background: rgba(0,0,0,0.5); color: #FFFFFF;"><div class="modal-body"><div class="text-center"><i class="fa fa-spinner fa-spin fa-2x"></i></div> <div class="message-box text-center form-control-static">正在载入...</div></div></div></div></div>'
},
register:function(events){
events = events || [];
if(events.length == 0){
events = ['alert', 'confirm', 'loading'];
}
var body = $(document.body);
this.modal = {};
for(var i=0; i<events.length; i++){
var event = events[i];
var tpl = this.tpls[event];
if(tpl){
this.modal[event] = $(tpl);
body.append(this.modal[event]);
}
}
},
alert:function(message, config){
config = config || {};
var confirmText = config.confirmText || "确定";
this.modal.alert.find(".btn-primary").text(confirmText);
this.modal.alert.find(".message-box").html(message);
this.modal.alert.modal("show");
},
confirm:function(message, config){
config = config || {};
var confirmText = config.confirmText || "确定";
var cancelText = config.cancelText || "取消";
this.modal.confirm.find(".btn-primary").text(confirmText);
this.modal.confirm.find(".btn-default").text(cancelText);
this.modal.confirm.find(".message-box").html(message);
this.modal.confirm.modal("show");
var _this = this;
this.modal.confirm.find(".btn-primary").on("click", function(){
if(typeof config.confirm == "function"){
config.confirm();
}
_this.modal.confirm.modal("hide");
});
},
loading:function(message){
this.modal.loading.find(".message-box").html(message);
this.modal.loading.modal({backdrop:'static'});
},
dismissLoading:function(){
this.modal.loading.find(".message-box").html("");
this.modal.loading.modal("hide");
}
};
Modal.register();
Bootstrap Modal 框 alert confirm loading的更多相关文章
- Bootstrap 警告框(Alert)插件
警告消息大多来是用来向终端用户提示警告或确认的消息,使用警告框插件,您可以向所有的警告框消息添加取消功能. 用法 您有以下两种方式启用警告框的可取消功能. 1.通过data属性:通过数据添加可取消功能 ...
- js 重写 bootstrap 样式 alert/confirm 消息窗口
相信很多人都受够了 alert.confirm 的样子,最近正在用 bootstrap 做项目,顺便封装了一个 bootstrap 样式的消息框. 实现起来很简单,bootstrap 本身就自带了 m ...
- Bootstrap 模态框(Modal)插件
原文链接:http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html Bootstrap 模态框(Modal)插件 模态框(Modal)是覆 ...
- js控制Bootstrap 模态框(Modal)插件
js控制Bootstrap 模态框(Modal)插件 http://www.cnblogs.com/zzjeny/p/5564400.html
- bootstrap模态框modal使用remote第二次加载显示相同内容解决办法
bootstrap模态框modal使用remote动态加载内容,第二次加载显示相同内容解决办法 bootstrap的modal中,使用remote可以动态加载页面到modal-body中,并弹窗显示 ...
- selenium python (十一)alert/confirm/prompt的处理(js中的弹出框)
webdriver中处理js所生成的alert.confirm以及prompt,采用switch_to_alert()方法定位到alert/confirm/prompt.然后使用text/accept ...
- JS 提示框 alert()、confirm()、prompt()的三者的区别
使用消息框 使用警告.提示和确认 可以使用警告.确认和提示消息框来获得用户的输入.这些消息框是 window 对象的接口方法.由于 window 对象位于对象层次的顶层,因此实际应用中不必使用这些消息 ...
- jquery仿alert提示框、confirm确认对话框、prompt带输入的提示框插件[附实例演示]
jquery仿alert提示框.confirm确认对话框.prompt带输入的提示框插件实例演示 第一步:引入所需要的jquery插件文件: http://www.angelweb.cn/Inc/eg ...
- Bootstrap modal模态框关闭时,combobox input下拉框仍然保留在页面上
问题描述: 当点击模态框的关闭按钮时,下拉框中的内容没有消失,而是移动到了页面左上角 分析:这个问题的定位在于是用的哪种模态框,bootstrap和easyui都可以实现模态框,但是两个方法实现的模态 ...
随机推荐
- gcc常用的编译选项
一.程序编译过程 程序编译的时候,要分四个阶段 : 1.预处理阶段,完成宏定义和include文件展开等工作: 2.根据编译参数进行不同程度的优化,编译成汇编代码: 3.用汇编器把汇编代码进一步生成目 ...
- 如何将BarTender内容锁定不让改动
条码标签代表的是产品的特性等,具有相当的精确性,所以需要保证它的正确性.而使用BarTender软件,可以帮助小伙伴将设计的条码标签内容锁定,保护它而不被人改动.下面,小编就教教大家如何实现BarTe ...
- 误差逆传播(error BackPropagation, BP)算法推导及向量化表示
1.前言 看完讲卷积神经网络基础讲得非常好的cs231后总感觉不过瘾,主要原因在于虽然知道了卷积神经网络的计算过程和基本结构,但还是无法透彻理解卷积神经网络的学习过程.于是找来了进阶的教材Notes ...
- JFS 文件系统概述及布局分析
JFS 文件系统概述及布局分析 日志文件系统如何缩短系统重启时间 如果发生系统崩溃,JFS 提供了快速文件系统重启.通过使用数据库日志技术,JFS 能在几秒或几分钟之内把文件系统恢复到一致状态,而非日 ...
- -_-#【jsonp】cache
Cache jQuery’s JSONP Calls <script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.3 ...
- Android Studio导入Eclipse项目
随着Google 对新Android编辑器Android Studio(以下简称AS)的版本不断更新,越来越多的人开始由熟悉的编辑器Eclipse转向AS,而Eclipse开发团队也坦言将放弃对Ecl ...
- HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
Football Games Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)To ...
- document.getElementById的简便方式
封装自己的元素获取方法,使元素获取变得简便 注意:1.应该要防止定义的被重写,可将同名的重新定义 2.可将封装的对象置为全局对象,方便使用 通过id查找单个元素 封装方式: //通过id查找单个元 ...
- Contains Duplicate II ——LeetCode
Given an array of integers and an integer k, find out whether there there are two distinct indices i ...
- Xshell中文编码的设置
一直用的是SSH Secure Shell Client,关于中文乱码,一直找不到简便的解决方案,后来改用XShell,编码设置如下: 1.查看linux系统编码,linux命令: locale. 2 ...