15 Star 102 Fork 36

笔下光年 / Light Year Example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test_loading.html 6.78 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2019-12-08 20:00 . 上传项目
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>loading加载 - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<style>
@-webkit-keyframes spinner-border {
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spinner-borderspinner-border {
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.spinner-border {
display: inline-block;
vertical-align: text-bottom;
border: 0.125em solid currentColor;
border-right-color: transparent;
border-radius: 50%;
-webkit-animation: spinner-border .75s linear infinite;
animation: spinner-border .75s linear infinite;
}
.card-footer {
background-color: #fcfdfe;
border-top: 1px solid rgba(77,82,89,0.05);
padding: 10px 20px;
}
.card-footer .example-left .lyear-checkbox {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header"><h4>loading加载 jquery.lyear.loading</h4></div>
<div class="card-body">
<p>因为之前开源light year admin 模板时候,网友提到想要能自定义文字的加载动画效果,这是抽空弄的一个JS效果。里面的一些定位的计算参考了网上的开源项目。</p>
<p>算是个简单的加载动画js插件,可以采用css loading动画或者图片,并且设置loading文字。</p>
<div>
<pre><code>$('#test-btn').click(function() {
var l = $('body').lyearloading({
opacity : 0.1, // 遮罩层透明度,为0时不透明
backgroundColor : '#ccc', // 遮罩层背景色
imgUrl : '', // 使用图片时的图片地址
textColorClass : 'text-success', // 文本文字的颜色
spinnerColorClass : 'text-success', // 加载动画的颜色(不使用图片时有效)
spinnerSize : 'lg', // 加载动画的大小(不使用图片时有效,示例:sm/nm/md/lg,也可自定义大小,如:25px)
spinnerText : '加载中...', // 文本文字
zindex : 9999, // 元素的堆叠顺序值
});
setTimeout(function() {
l.hide();
}, 500000)
});
</code></pre>
</div>
<div class="form-group">
<label>示例一</label>
<button type="submit" class="btn btn-primary" id="example-one">确认提交</button>
</div>
<div class="form-group">
<label>示例二</label>
<button type="submit" class="btn btn-success" id="example-two">确认提交</button>
</div>
<div class="form-group">
<label>示例三</label>
<button type="submit" class="btn btn-info" id="example-three">确认提交</button>
</div>
<div class="form-group">
<label>示例四</label>
<button type="submit" class="btn btn-danger" id="example-four">确认提交</button>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<form class="card" id="login-form">
<div class="card-header"><h4>登录/注册</h4></div>
<div class="card-body">
<div class="form-group">
<input class="form-control" type="text" placeholder="用户名">
</div>
<div class="form-group">
<input class="form-control" type="text" placeholder="邮箱">
</div>
<div class="form-group">
<input class="form-control" type="password" placeholder="密码">
</div>
</div>
<footer class="card-footer clearfix">
<div class="example-left pull-left">
<label class="lyear-checkbox">
<input type="checkbox">
<span>五天内自动登录</span>
</label>
</div>
<div class="example-right pull-right">
<button class="btn btn-primary" type="reset" id="example-five">登录</button>
<button class="btn btn-danger" type="submit">注册</button>
</div>
</footer>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.lyear.loading.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// 按钮中的loading
$('#example-one').click(function(){
var l = $(this).lyearloading({
opacity: 0.2,
spinnerSize: 'nm'
});
setTimeout(function() {
l.destroy(); // 可以使用hide,页面中如果有多个loading,最好用destroy,避免后面的loading设置不生效
}, 1e3)
});
// 基于整个body的loading
$('#example-two').click(function(){
var l = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
setTimeout(function() {
l.destroy();
}, 1e3)
});
// 使用文字和颜色
$('#example-three').click(function(){
var l = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg',
spinnerText: '后台处理中,请稍后...',
textColorClass: 'text-info',
spinnerColorClass: 'text-info'
});
setTimeout(function() {
l.destroy();
}, 1e3)
});
// 使用图片
$('#example-four').click(function(){
var l = $('body').lyearloading({
opacity: 0.6,
backgroundColor: '#ffffff',
imgUrl: 'http://www.bixiaguangnian.com/home/images/loader.gif',
spinnerText: '后台处理中,请稍后...',
textColorClass: 'text-info'
});
setTimeout(function() {
l.destroy();
}, 1e3)
});
// 某一个div元素中的loading
$('#example-five').click(function(){
var l = $('#login-form').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
setTimeout(function() {
l.destroy();
}, 1e3)
});
});
</script>
</body>
</html>
HTML
1
https://gitee.com/yinqi/Light-Year-Example.git
git@gitee.com:yinqi/Light-Year-Example.git
yinqi
Light-Year-Example
Light Year Example
master

搜索帮助