A simple and practical CSS loading icon

Source: Internet
Author: User

Summary

In web development, in order to improve the user experience, when loading the data will give a loading hint.

Html
<!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head>    <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />    <title></title>    <Scriptsrc= "Http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></Script>    <style>. Cssload-container{width:24px;Height:24px;position:fixed;Top:260px; Left:50%;Margin-left:-12px;        }. Cssload-speeding-wheel{width:60px;Height:60px;margin:0 Auto;Border:2px solid Rgba (0,0,0,0.25);Border-radius:50%;Border-left-color:Transparent;Border-right-color:Transparent;Animation:cssload-spin 575ms Infinite linear;-o-animation:cssload-spin 575ms Infinite linear;-ms-animation:cssload-spin 575ms Infinite linear;-webkit-animation:cssload-spin 575ms Infinite linear;-moz-animation:cssload-spin 575ms Infinite linear;        }@keyframes Cssload-spin{100% {Transform:Rotate (360deg);Transform:Rotate (360deg);            }} @-o-keyframes Cssload-spin{100% {-o-transform:Rotate (360deg);Transform:Rotate (360deg);            }} @-ms-keyframes Cssload-spin{100% {-ms-transform:Rotate (360deg);Transform:Rotate (360deg);            }} @-webkit-keyframes Cssload-spin{100% {-webkit-transform:Rotate (360deg);Transform:Rotate (360deg);            }} @-moz-keyframes Cssload-spin{100% {-moz-transform:Rotate (360deg);Transform:Rotate (360deg);            }        }    </style></Head><Body>    <Divclass= "Cssload-container">        <Divclass= "Cssload-speeding-wheel"></Div>    </Div>    <Script>        functionshowloading () {$ (". Cssload-container"). Show ();        }; functionhideloading () {$ (". Cssload-container"). Hide ();        }; var Times= 1; SetInterval (function () {            if( times% 2 === 0) {hideloading (); } Else{showloading ();            }; Times++; },  -)    </Script></Body></HTML>

Effect

Paste in the required CSS and put the code on the page that needs to be displayed.

<class= "Cssload-container">        <class  = "Cssload-speeding-wheel"></div>    </ Div >

Control display and Hidden JS

   function showloading () {            $ (". Cssload-container"). Show ();        };        function hideloading () {            $ (". Cssload-container"). Hide ();        };

A simple and practical CSS loading icon

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.