Implementation of the animation effect of loading before the ajax request is completed

不言
Release: 2018-08-02 11:58:31
Original
3704 people have browsed it

This article introduces to you the implementation of the animation effect of loading before the ajax request is completed. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Many times we need to introduce frameworks to develop projects. At this time, we may encounter the problem that the source code has not been loaded before the page is loaded, giving the user a bad visual experience. This is convenient. Loading is required to improve the user experience!

/*loading.js*/ // 加载HTML图 var _LoadingHtml = '
加载中。。。
'; // 呈现loading效果 document.write(_LoadingHtml); // 监听加载状态改变 document.onreadystatechange = completeLoading; // 加载状态为complete时移除loading效果 function completeLoading() { if (document.readyState == "complete") { var loadingMask = document.getElementById('loadingDiv'); loadingMask.parentNode.removeChild(loadingMask); } }
Copy after login

Recommended related articles:

A brief discussion on high concurrency and distributed clusters in node.js Content

How to use php to find components that have been imported but not used in vue

The above is the detailed content of Implementation of the animation effect of loading before the ajax request is completed. 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
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!