layerui
引用layer.js,官网:http://layer.layui.com/
常用属性:btn/icon/skin/time/content/yes(点击确认、提交)
常用窗体
.alert
layer.alert("内容");
layer.alert('墨绿风格,点击确认看深蓝', {
skin: 'layui-layer-molv'//样式类名
, closeBtn: 0
}, function () {
layer.alert('偶吧深蓝style', {
skin: 'layui-layer-lan'
, closeBtn: 0
, shift: 2 //动画类型
});
});
.confirm
layer.confirm('您是如何看待前端开发?',{
btn: ['重要', '奇葩'] //按钮
}, function () {
layer.msg('的确很重要', { icon: 1 });
}, function () {
layer.msg('也可以这样', {
time: 20000, //20s后自动关闭
btn: ['明白了', '知道了']
},function() {
layer.msg('明白就好', { time: 20000 });
},function() {
layer.msg('知道就好', { time: 20000 });
});
});
.msg
layer.msg('hello.');
.open 自定义窗口
layer.open({
type: 1,
skin: 'layui-layer-demo',//样式类名
btn: ["关闭"],
/*closeBtn: 0, //不显示关闭按钮*/
shift: 2,
shadeClose: true, //开启遮罩关闭
content: '内容'
});
layer.open({
type: 2,
title: 'layer mobile页',
shadeClose: true,
shade: 0.8,
area: ['700px','90%'],
content: 'http://layer.layui.com/mobile/'//iframe的url
});
.html
$("#layerOpen").html('<imgsrc="/images/loading.gif"/>正在努力为您搜索,请稍后...');
.load 加载
$("#layerOpen").load("/Order/ProductList");
.tips
关闭layer
用一个变量存储弹窗,在需要关闭的地方调用close方法
<div style="display:none;"id="layerOpen"></div>
var layerOpen = null; //弹窗变量
layerOpen=layer.open({
type: 1,
title: "查看XXX的详情",
area: ["1000px","600px"],
content: $("#layerOpen"),
cancel: function () {
$("#layerOpen").html("");
}
});
layer.close(layerOpen);
打开自定义页面
$("#layerOpen").html('<imgsrc="/images/loading.gif"/>正在努力为您搜索,请稍后...');
$("#layerOpen").load("/Controller/Action");
layerOpen = layer.open({
type: 1,
title: "选择XXX",
area: ["1000px","600px"],
content: $("#layerOpen"),
cancel: function () {
$("#layerOpen").html("");
}
});
加载页面
保存变量,打开页面赋值,关闭页面
//加载layer
var load = null;
$.ajax({
type: "POST",
url: "/Controller/Action",
data: {
"PKID":PKID,
"Path": path
},
beforeSend: function () {
load = layer.load(0, { shade:[0.3, '#000'] });//0代表加载的风格,支持0-2
},
success: function (result) {
if (load != null) {
layer.close(load);
}
layer.alert(result.Msg, '提示');
}
});
layerui的更多相关文章
- 【Javascript】好用的js弹层插件,layerUI
官网:layerUI 中文手册:layerAPI
- layerUi与AJAX的一种思路
javascript:function rep(id) { layer.confirm("确定要拒绝此认证吗?", { btn: ["确定", "取消 ...
- layerui如何隐藏按钮?
https://www.layui.com/doc/modules/layer.html#btn 建议把 btn: ['取消'],btnAlign: 'c',yes: function (index) ...
- LayeruI Loadding Custom word
var getTableResult = function (pageIndex, pageSize) { var index = layer.load(2, { content: '加载中..... ...
- layerui如何设置显示的位置?
转自:http://www.layui.com/doc/modules/layer.html#offset layer.open({ type: 1,//默认:0 (0表示信息框,1表示页面层,2表示 ...
- Layerui 弹出层的位置设置
距顶 offset: '300px' 例1: layer.msg("请先选择项!", { offset: '300px' });例2: layer.confirm("确定 ...
- layerui ios不适应问题
.admin-main {-webkit-overflow-scrolling: touch; overflow: scroll; position: absolute; left: 0; top: ...
- layerui上传文件
参考: http://www.layui.com/doc/modules/upload.html <1> 文件上传(以下函数必须要在js文件加载时执行) upload.render({ e ...
- Turtle Online:致力于打造超接地气的PC前端架构,组件+API,快速搭建前端开发
架构创作初衷 每当新开一个项目时,都会绞尽脑汁去考虑采用哪种框架:requirejs/seajs.jquery/zepto.backbone.easeUI/Bootstrap/AngularJS……, ...
随机推荐
- Java解惑八:很多其它库之谜
本文是依据JAVA解惑这本书,做的笔记. 电子书见:http://download.csdn.net/detail/u010378705/7527721 谜题76 将线程的启动方法start(),写成 ...
- 关于serialVersionUID的说明 分类: B1_JAVA 2014-05-24 11:02 1334人阅读 评论(0) 收藏
1.为什么要使用serialVersionUID (1)对于实现了Serializable接口的类,可以将其序列化输出至磁盘文件中,同时会将其serialVersionUID输出到文件中. (2)然后 ...
- USB 3.0规范中译本 第8章 协议层
本文为CoryXie原创译文,转载及有任何问题请联系cory.xie#gmail.com. 协议层管理设备及其主机之间端到端的数据流.这一层建立在链路层提供对某些类型的包的保证传输(guarantee ...
- Windows环境搭建Web自己主动化測试框架Watir(基于Ruby)
web自己主动化測试一直是一个比較迫切的问题 图1-1 须要安装的工具 http://railsinstaller.org/ 由于安装Ruby还须要用到其它的一些开发工具集.所以建议从站点http:/ ...
- 【a703】求逆序对(线段树的解法)
Time Limit: 10 second Memory Limit: 2 MB 问题描述 给定一个序列a1,a2...an.如果存在i小于j 并且ai大于aj,那么我们称之为逆序对,求给定序列中逆序 ...
- OpenCV中CvSVM部分函数解读
CvSVM::predict函数解析:无论是Mat接口还是CvMat接口终于都是通过指针的形式调用的.也就是终于都是调用的下面函数实现的 float CvSVM::predict( const flo ...
- Word Break II -- leetcode
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...
- SVM明确的解释1__
线性可分问题
笔者:liangdas 出处:简单点儿,通俗点儿,机器学习 http://blog.csdn.net/liangdas/article/details/44251469 引言: 1995年Cor ...
- Lettcode_104_Maximum Depth of Binary Tree
本文研究的总结,欢迎转载,但请注明出处:http://blog.csdn.net/pistolove/article/details/41964475 Maximum Depth of Binary ...
- CodeBlocks提供了预编译的WxWidgets模块,并预置TDM
Miscellaneous For Windows, we also provide the pre-compiled wxWidgets, version 2.8.12 used to compil ...