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

后端 未结 17 2190
长情又很酷
长情又很酷 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:52

    SVG animations are probably a better solution to this problem. You won't need to worry about writing CSS and compared to GIFs, you'll get better resolution and alpha transparency. Some very good SVG loading animations that you can use are here: http://samherbert.net/svg-loaders/

    You can also use those animations directly through a service I built: https://svgbox.net/icon-set/loaders. It allows you to customize the fill and direct usage (hotlinking) is permitted.

    To accomplish what you want to do with jQuery, you probably should have a loading info element hidden and use .show() when you want to show the loader. For eg, this code shows the loader after one second:

    setTimeout(function() {
      $("#load").show();
    }, 1000)
    
    
    

提交回复
热议问题