Loading loading and Layer.js

Source: Internet
Author: User

Loading loading in the Layer.js

L This article mainly introduces the application of loading loading in Layerjs in the actual project.

1, the use of technology

Front End: Html5+css3+js+layer.js
Back end:. Net

2. Problems encountered

When using the loading provided in the Layer.js plug-in, the corresponding GIF format dynamic graph needs to be found in the layer.css in Layer.js, which needs to be the same size as the loading loaded GIF in the plug-in.

3. Introduction of Load () method in Layer.js

Load does not need to pass too many parameters, according to the style you like to set. The method is available in three styles for selection. And the icon in load supports incoming 0-2, if it is 0, no need to pass in. However, load is not closed by default and needs to be closed in the callback function.
Method One:
var index = layer.load (); Do not pass in parameters, default 0
Method Two:
var index = layer.load (1); Parameter 1, another style
Method Three:
var index = layer.load (2,{time:10*1000}); Parameter 2, in a different style; time setting maximum wait

4, the actual project application

In the corresponding HTML page that needs to load loading to add the code to write loading load, the first page to log on to the screen as an example:
1) Set the login interface's Click event:

$(‘#submit‘).click(function() {    $(this).css(‘background‘,‘green‘);//设置当前点击登录按钮后,改变其登录框的颜色 confirm(); //调用ajax函数})

2) Loading load:

$(function() {$.ajaxsetup ({layerindex:-1, Beforesend:function() {Plug-in before loadingThis.layerindex = Layer.load (0, {shade: [0.01, ' #fff ']}), $ (' #submit '). Val ("Logging in")}, Complete: function () { //after loading Executive Layer.close (This.layerindex); //Finish loading close loading}, Error: function () { //error when executing Layer.alert (' show exception, please retry after refresh ', {skin: ') Layui-layer-molv ', closebtn: 0, Shift: 4 //Animation type})       ;}); 

Loading loading and layer.js

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.