zoukankan      html  css  js  c++  java
  • js+css实现全局loading加载

    js

    var Mask = function() {   //定义一个Mask对象
    	this.btn = ["取消", "确定"],
    	this.init = function(){
    	},
    	this.open = function(html){
    		$("body").append(html);
    		$("html,body").css("overflow", "hidden");
    		this.init();
    	},
    	this.close = function() {
    		$(".mask").hide();
    		$("html,body").css("overflow", "auto");
    	}
    };
    Mask.prototype.loding = function(msg){//给Mask的原型上加一个loading的方法
        var _this = this;
        var html = '<div class="toast_loading"><img src="./imges/loadinig.png" class="aniLoad"> <p style="line-height:1;">正在加载中…</p ></div>';
         setTimeout(function (){
        		$('.toast_loading').hide();
        	},1000);
    _this.open(html);
    
    }
    

    css

    .toast_loading {
    	 1.28rem;
    	height: 1.28rem;
    	border-radius: 4px;
    	background: rgba(0, 0, 0, .6);
    	position: fixed;
    	top: 50%;
    	left: 50%;
    	margin-left: -0.6rem;
    	margin-top: -0.6rem;
    	z-index: 100;
    	overflow: hidden;
    	color: #fff;
    	text-align: center;
    }
    
    .toast_loading img{
    	transform-origin: 50% 50%;
    	transform: rotate(0deg);
    	animation: carMove 1.5s infinite;
    	-webkit-animation: carMove 1.5s infinite;
    }
    
    @keyframes carMove {
    	0% {
    		transform: rotate3D(0, 0, 1, 0deg);
    	}
    	to {
    		transform: rotate3D(0, 0, 1, 360deg);
    	}
    }
    
    @-webkit-keyframes carMove {
    	0% {
    		-webkit-transform: rotate3D(0, 0, 1, 0deg);
    	}
    	to {
    		-webkit-transform: rotate3D(0, 0, 1, 360deg);
    	}
    }
    

    使用方法

            Mask.loding();
    
  • 相关阅读:
    kernel structure
    linux cmd fuser/screen
    arm 指令架构
    udev 学习
    grup 2 ubuntu
    tiny6410 3.8.1 内核kgdb调试
    make 选项
    lfs 无知
    数据归一化的两种方法:最值归一化和0均值归一化
    使用随机队列实现生成迷宫
  • 原文地址:https://www.cnblogs.com/lml-lml/p/9092235.html
Copyright © 2011-2022 走看看