Javascript 网站加载时显示旋转轮或进度条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10409730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Show spinning wheel or progressbar when website is loading
提问by nimrod
I am building a treeview with a jQuery plugin called jquery-treeview. Building up this treeview takes a lot of time (ca. 5-7 sec) and I want to show a spinning wheel or a progress bar when the page is loading. Does anyone know how to do that? I only found solutions for loading videos or images where it is known how much data has to be loaded.
我正在使用名为 jquery-treeview 的 jQuery 插件构建树视图。建立这个树视图需要很多时间(大约 5-7 秒),我想在页面加载时显示一个旋转轮或一个进度条。有谁知道这是怎么做到的吗?我只找到了加载视频或图像的解决方案,其中知道必须加载多少数据。
回答by James Thomas
Try this website:
试试这个网站:
http://fgnass.github.com/spin.js/
http://fgnass.github.com/spin.js/
You can create a spinner of your choice and then they give examples of how to use it below.
您可以创建您选择的微调器,然后他们在下面给出了如何使用它的示例。
Hope that helps :)
希望有帮助:)
回答by Tats_innit
Hiya see this demohttp://jsfiddle.net/hEB7d/orhttp://jsfiddle.net/Eh8tU/(just to show image)
Hiya 看到这个演示http://jsfiddle.net/hEB7d/或http://jsfiddle.net/Eh8tU/(只是为了显示图像)
Bruv , for progress bar try twitter bootstrap, orflick some code I might be able to see an help you out.
Brav ,对于进度条,请尝试 twitter bootstrap,或者轻弹一些代码,我可能会看到对您的帮助。
Idea is that code know when on load
and on success
will happen for your code snippet and put the image load in-between that process.
想法是代码知道您的代码片段何时on load
以及on success
将发生,并将图像加载置于该过程之间。