Ajax loading chrysanthemum loding effect
This article mainly introduces the relevant information on the chrysanthemum loding effect of Ajax loading. It is very good and has reference value. Friends in need can refer to it
When Ajax asynchronously requests, a dynamic one is generally used. Gif small pictures to create an Ajax Loading to increase user experience.
Here we use Spin.js. The js script is compressed to 5k and can create an Ajax Loading indicator without any pictures or external CSS styles.
We can create an Ajax Loading indicator on the link page , dynamically setting the style will automatically generate the style configuration script:
Spin.js Usage is extremely simple:
Display spinner
var target=document.getElementById("id") spinner.spin(target);
Hide spinner
spinner.spin();
Let’s do a simple and complete example to experience it:
<script type="text/javascript" src="zepto.min.js"></script> <script type="text/javascript" src="spin.min.js"></script> <script type="text/javascript"> //第一个参数为loading图标加载的标签,第二个为ajax的数据接口,第三个为回调函数。 function loadAjaxSpin(ele, get_url, callback) { var opts = { lines: 13, // 花瓣数目 length: 20, // 花瓣长度 width: 10, // 花瓣宽度 radius: 30, // 花瓣距中心半径 scale: 1, corners: 1, // 花瓣圆滑度 (0-1) color: '#000', // 花瓣颜色 opacity: 0.25, rotate: 0, // 花瓣旋转角度 direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针 speed: 1, // 花瓣旋转速度 trail: 60, // 花瓣旋转时的拖影(百分比) zIndex: 2e9, // spinner的z轴 (默认是2000000000) className: 'spinner', // spinner css 样式名称 top: '50%', // spinner 相对父容器Top定位 单位 px left: '50%', // spinner 相对父容器Left定位 单位 px shadow: false, // 花瓣是否显示阴影 hwaccel: false, //spinner 是否启用硬件加速及高速旋转 position: 'absolute' }; var spinner = new Spinner(opts); $(ele).show(); var target = $(ele)[0]; spinner.spin(target); $.ajax({ url: get_url, dataType: 'html', success: function(data) { spinner.spin(); $(ele).hide(); callback(data); } }) } var foo = function(data) { console.log(data); } $(function() { $('#btnRequest').on('click', function() { loadAjaxSpin('.spin', 'http://192.168.1.191/h5/font.html', foo); }); }); </script> <p class="spin"></p> <p> <input id="btnRequest" type="button" value="请求数据" /> </p>
In the above example, we wrote a function loadAjaxSpin. The function is that the loading icon appears before the ajax call starts. After the data is loaded, the loading icon disappears.
Effect: After clicking, the chrysanthemum is displayed, and then the callback is executed. function.
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Configuration of Ajax global loading box (Loading effect)
Cascade operation of drop-down menu
Simple application based on Ajax form submission and background processing
The above is the detailed content of Ajax loading chrysanthemum loding effect. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



You may have encountered the problem of green lines appearing on the screen of your smartphone. Even if you have never seen it, you must have seen related pictures on the Internet. So, have you ever encountered a situation where the smart watch screen turns white? On April 2, CNMO learned from foreign media that a Reddit user shared a picture on the social platform, showing the screen of the Samsung Watch series smart watches turning white. The user wrote: "I was charging when I left, and when I came back, it was like this. I tried to restart, but the screen was still like this during the restart process." Samsung Watch smart watch screen turned white. The Reddit user did not specify the smart watch. Specific model. However, judging from the picture, it should be Samsung Watch5. Previously, another Reddit user also reported

Speaking of ASSASSIN, I believe players will definitely think of the master assassins in "Assassin's Creed". They are not only skilled, but also have the creed of "devoting themselves to the darkness and serving the light". The ASSASSIN series of flagship air-cooled radiators from the appliance brand DeepCool coincide with each other. Recently, the latest product of this series, ASSASSIN4S, has been launched. "Assassin in Suit, Advanced" brings a new air-cooling experience to advanced players. The appearance is full of details. The Assassin 4S radiator adopts a double tower structure + a single fan built-in design. The outside is covered with a cube-shaped fairing, which has a strong overall sense. It is available in white and black colors to meet different colors. Tie

Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.

With the arrival of spring, everything revives and everything is full of vitality and vitality. In this beautiful season, how to add a touch of color to your home life? Haqu H2 projector, with its exquisite design and super cost-effectiveness, has become an indispensable beauty in this spring. This H2 projector is compact yet stylish. Whether placed on the TV cabinet in the living room or next to the bedside table in the bedroom, it can become a beautiful landscape. Its body is made of milky white matte texture. This design not only makes the projector look more advanced, but also increases the comfort of the touch. The beige leather-like material adds a touch of warmth and elegance to the overall appearance. This combination of colors and materials not only conforms to the aesthetic trend of modern homes, but also can be integrated into

With its compact size, the ITX platform has attracted many players who pursue the ultimate and unique beauty. With the improvement of manufacturing processes and technological advancements, both Intel's 14th generation Core and RTX40 series graphics cards can exert their strength on the ITX platform, and gamers also There are higher requirements for SFX power supply. Game enthusiast Huntkey has launched a new MX series power supply. In the ITX platform that meets high-performance requirements, the MX750P full-module power supply has a rated power of up to 750W and has passed 80PLUS platinum level certification. Below we bring the evaluation of this power supply. Huntkey MX750P full-module power supply adopts a simple and fashionable design concept. There are two black and white models for players to choose from. Both use matte surface treatment and have a good texture with silver gray and red fonts.

A large model that can automatically analyze the content of PDFs, web pages, posters, and Excel charts is not too convenient for workers. The InternLM-XComposer2-4KHD (abbreviated as IXC2-4KHD) model proposed by Shanghai AILab, the Chinese University of Hong Kong and other research institutions makes this a reality. Compared with other multi-modal large models that have a resolution limit of no more than 1500x1500, this work increases the maximum input image of multi-modal large models to more than 4K (3840x1600) resolution, and supports any aspect ratio and 336 pixels to 4K Dynamic resolution changes. Three days after its release, the model topped the HuggingFace visual question answering model popularity list. Easy to handle

jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error

In the current era of rapid technological development, laptops have become an indispensable and important tool in people's daily life and work. For those players who have high performance requirements, a laptop with powerful configuration and excellent performance can meet their hard-core needs. With its excellent performance and stunning design, the Colorful Hidden Star P15 notebook computer has become the leader of the future and can be called a model of hard-core notebooks. Colorful Hidden Star P1524 is equipped with a 13th generation Intel Core i7 processor and RTX4060Laptop GPU. It adopts a more fashionable spaceship design style and has excellent performance in details. Let us first take a look at the features of this notebook. Supreme equipped with Intel Core i7-13620H processing
