Best way to display a loading spinner in Django?

不羁的心 提交于 2020-02-23 08:32:17

问题


What is the best way to display a loading spinner in Django during a relatively lengthy server-side processing task? Is this something that JS/jQuery should handle?

If so, how do I get the button click that starts the server-side processing to initiate the spinner?

Django novice here, so I appreciate any input. Thanks!


回答1:


There are many ways of doing this, I'm going to suggest the simplest:

Use an animated gif

yes. I know, you're probably thinking, "animated gifs are tacky!"

to which I reply: "only if they're ugly."

Make a simple loading spinner animation as a gif, and add it to the display list when you want it shown. When the process is over, remove it from the display list.

It's about the only good use of an animated gif I've ever come up with.



来源:https://stackoverflow.com/questions/4617289/best-way-to-display-a-loading-spinner-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!