How can I create a “Please Wait, Loading…” animation using jQuery?

后端 未结 17 1970
长情又很酷
长情又很酷 2020-11-22 00:07

I would like to place a \"please wait, loading\" spinning circle animation on my site. How should I accomplish this using jQuery?

17条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 00:54

    Per https://www.w3schools.com/howto/howto_css_loader.asp, this is a 2-step process with no JS:

    1.Add this HTML where you want the spinner:

    2.Add this CSS to make the actual spinner:

    .loader {
        border: 16px solid #f3f3f3; /* Light grey */
        border-top: 16px solid #3498db; /* Blue */
        border-radius: 50%;
        width: 120px;
        height: 120px;
        animation: spin 2s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    

提交回复
热议问题