css-loading

A css3-based Loading, pure js, does not depend on Jquery, is compatible with all browsers that support H5, css and js files are only 5.7KB in total size, support for custom loading colors, mask colors, loading fade and animation times and loading The Applicability is strong, easy to use.(一个基于css3的加载Loading,用于ajax等耗时操作的阻塞。纯js编写,不依赖Jquery,兼容所有支持H5的浏览器,css和js文件总大小仅5.7KB,支持定制Loading颜色,遮罩颜色,Loading淡入淡出动画时长,以及loading的大小。适用性强,使用简单方便)

Stars
8

H5Loading

A css3-based Loading, pure js is written, does not depend on Jquery, is compatible with all browsers that support H5, css and js files are only 5.7KB in total size, support for custom loading colors, mask colors, loading fade and animation times and loading The Applicability is strong, easy to use.

css3LoadingajaxjsJqueryH5cssjs5.7KBLoadingLoadingloading

View the demo

tutorials

  1. css<link rel="stylesheet" type="text/css" href="css/loading.css"/>

  2. js <script src="js/loading.js" type="text/javascript" charset="utf-8"></script>

  3. loadingwindowH5_loading

  4. H5_loadingshow()hide()

  5. show()optionoptioncolorloadingbackgroundtimeout(s)scale

  6. hide()timeout

  7. introduce css: <link rel =" stylesheet "type =" text / css "href =" css / loading.css "/>

  8. introduce js: <script src =" js / loading.js "type =" text / javascript "charset =" utf-8 "> </ script>

  9. It registers a global object name on the window: H5_loading.

  10. The H5_loading object has two methods: show () and hide ().

  11. show () accept an object parameter that allows four subparameters: color - loading circle color, background - mask layer color, timeout - fade in animation time (s), scale - zoom factor.

  12. hide () accepts a timeout parameter

  13. Use example:

    H5_loading.show();    //loding

  H5_loading.show({color:"#666",background:"rgba(0,0,0.5)",timeout:0.5,scale:0.5});   // 0.5loading

    H5_loading.hide();     //loading

    H5_loading.hide(0.5);  //loading0.5s
  1. ajax

    $(document).ajaxSend(function(){
        H5_loading.show();
    });
    
    $(document).ajaxComplete(function(){
        H5_loading.hide();
    });