Home > Web Front-end > H5 Tutorial > body text

Implementation code sharing of html5 custom mask

黄舟
Release: 2017-03-31 13:30:09
Original
2262 people have browsed it

html5Custom mask implementation code sharing

ys_loading.css

.ys-loading{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    right:0;
    z-index: 9999;
}
 
.ys-loading em{
    position:absolute;
    left:0;
    right:0;
    top:0;
    bottom:0;
    width:44px;
    height:44px;
    margin:auto;
    border-radius: 22px;
    opacity: 0.3;
    overflow: hidden;
}
 
.ys-loading em:before{
    content:"";
    display:block;
    width:46px;
    height:46px;
    background:url(../../images/common/ajax-loader.gif) no-repeat center center;
    background-size:contain;
    margin-top:-1px;
    margin-left:-1px;
}
Copy after login

ys_loading.js

(function($){
 
    var container = null;
 
    var html =  "<div class=&#39;ys-loading&#39;><em></em></div>";
 
    function render(){
        container = $(html).appendTo("body");
    }
    var initialized = false;
    function init(){
        if(initialized){
            return;
        }
        initialized = true;
        render();
    }
 
    var LoadingWidget = {
        showLoading:function(){
            init();
            container.show();
        },
        hideLoading:function(){
            container.hide();
        }
    };
 
    window.LoadingWidget = LoadingWidget;
})(jQuery);
Copy after login

Implementation code sharing of html5 custom mask

The above is the detailed content of Implementation code sharing of html5 custom mask. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!