The progress bar of spin. js without images for loading is supported but not dependent on jquery.

Source: Internet
Author: User

Features:
1. No image, no external CSS
2. No dependency (jQuery supported, but not required)
3. configurable height
4. Resolution independence
5. VML is supported when the earlier version of IE is not supported.
6. Use the Key Frame Animation and setTimeout ()
7. compatible with various mainstream browsers, including IE6
8. MIT Authentication

Spin. js dynamically creates a progress bar, which can be replaced by loading GIF images using ajax.
 

<Body> <div id = "myspin"> </div> <script src = "spin. js "> </script> <script> var opts = {lines: 13, // Number of drawn lines length: 20, // length of each line width: 10, // width radius: 30, // the radius of the rounded Corner of the line corners: 1, // Corner roundness (0 .. 1) rotate: 0, // rotation offset direction: 1, // 1: clockwise,-1: counterclockwise color: '#000 ', // # rgb or # rrggbb or array of colors speed: 1, // speed/second trail: 60, // Afterglow percentage shadow: false, // whether to display shadow hwaccel: false, // whether or not to use hardware acceleration className: 'scheduler', // The class name zIndex: 2e9 bound to the spinner, // The positioning layer (default: 2000000000) top: 'auto', // located relative to the parent element, unit: px left: 'auto' // left positioned relative to the parent element, unit: px}; var target = document. getElementById ("myspin"); var spinner = new Spinner (opts ). spin (target) </script> </body> <div id = "myspin"> </div> <script src = "spin. js "> </script> <script> var opts = {lines: 13, // Number of drawn lines length: 20, // length of each line width: 10, // width radius: 30, // the radius of the rounded Corner of the line corners: 1, // Corner roundness (0 .. 1) rotate: 0, // rotation offset direction: 1, // 1: clockwise,-1: counterclockwise color: '#000 ', // # rgb or # rrggbb or array of colors speed: 1, // speed/second trail: 60, // Afterglow percentage shadow: false, // whether to display shadow hwaccel: false, // whether or not to use hardware acceleration className: 'scheduler', // The class name zIndex: 2e9 bound to the spinner, // The positioning layer (default: 2000000000) top: 'auto', // located relative to the parent element, unit: px left: 'auto' // left positioned relative to the parent element, unit: px}; var target = document. getElementById ("myspin"); var spinner = new Spinner (opts ). spin (target) </script> </body>

 

The spin () method initializes the necessary HTML elements and starts the animation. If the target element is passed as a parameter, the spinner is taken as the first

Child node, added to the parent node, horizontally and vertically centered.


Manual positioning:
The default value is horizontal and vertical center. We can manually configure the top and left in the initialization parameter to locate the target element.

To manually insert a spinner to a DOM node, call the spin () method without any parameters. Use the el attribute to access HTML elements. As follows:
Var spinner = new Spinner (). spin ();
Target. appendChild (spinner. el );
The returned result is a relatively positioned DIV [class = "spinner"] element with a height of 0. The center of the spinner is located in the upper left corner of the div.

 

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.