setting: okLoading
parent
4ec06f4899
commit
e487cb2b0a
|
|
@ -1,10 +1,10 @@
|
||||||
"use strict";
|
var ok_load_options = {
|
||||||
layui.define(["jquery"], function (exprots) {
|
time: 1000,
|
||||||
|
content: "ok-admin..."
|
||||||
var $ = layui.jquery;
|
};
|
||||||
|
!function (content, options) {
|
||||||
function templateFun(options) {
|
function templateFun(options) {
|
||||||
return `<div id="okLoadering">
|
return `<div class="ok-loading">
|
||||||
<div class="loader">
|
<div class="loader">
|
||||||
<div class="text">${options.content}</div>
|
<div class="text">${options.content}</div>
|
||||||
<div class="horizontal">
|
<div class="horizontal">
|
||||||
|
|
@ -46,28 +46,30 @@ layui.define(["jquery"], function (exprots) {
|
||||||
function headerInit(content, options) {
|
function headerInit(content, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if (typeof content == "string") {
|
if (typeof content == "string") {
|
||||||
options["content"] = content || "ok-admin...";
|
options["content"] = content || ok_load_options.content;
|
||||||
} else if (typeof content == "object") {
|
} else if (typeof content == "object") {
|
||||||
options = content;
|
options = content;
|
||||||
}
|
}
|
||||||
options.time = options.time || 1000;
|
options.time = options.time || ok_load_options.time;
|
||||||
options.content = options.content || "ok-admin...";
|
options.content = options.content || ok_load_options.content;
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
var okLoading = function (content, options, dom) {
|
ok_load_options = headerInit(content, options);
|
||||||
dom = dom || $("body");
|
var template = templateFun(ok_load_options);
|
||||||
var options = headerInit(content, options);
|
document.writeln(template);
|
||||||
var template = templateFun(options);
|
}();
|
||||||
$(dom).append(template);
|
|
||||||
$(dom).find('#okLoadering').delay(options.time).animate({
|
var okLoading = {
|
||||||
|
close: function ($, time, dom) {
|
||||||
|
time = time || ok_load_options.time;
|
||||||
|
dom = dom || document.getElementsByTagName("body")[0];
|
||||||
|
$(dom).find('.ok-loading').delay(time).animate({
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}, 1000, "linear", function () {
|
}, 1000, "linear", function () {
|
||||||
$(dom).find("#okLoadering").remove();
|
$(dom).find(".ok-loading").remove();
|
||||||
});
|
});
|
||||||
/*$('#okLoadering').delay(options.time).hide(1000,"linear",function () {
|
}
|
||||||
console.log("执行完成");
|
|
||||||
});*/
|
|
||||||
};
|
};
|
||||||
exprots("okLoading", okLoading);
|
|
||||||
});
|
|
||||||
Loading…
Reference in New Issue