【问题标题】:How can I make an animated gif appear when the site is loading and disappear after it's done loading?如何在网站加载时显示动画 gif 并在加载完成后消失?
【发布时间】:2011-07-19 09:39:04
【问题描述】:

我一直在这里使用插件:http://contextllc.com/tools/jQuery-showLoading 当它是一个 ajax 请求或任何其他元素交互时,它可以完美地工作,但是如何让动画在网站首次加载时出现并在它完成加载后消失?

【问题讨论】:

  • 仅供参考:提到的链接已损坏,至少目前是这样,而且我没有看到 1.0 后的版本。

标签: jquery-plugins throbber


【解决方案1】:

您可以使用 javascripts onLoad 事件来显示动画和 jquery .ready()-function 来删除它。 More about onload eventmore about .ready()-function

【讨论】:

  • 我试过了,但它会在所有内容都加载后加载(或者至少在 PHP 加载之后,这是我想要表明正在加载的内容)
  • 您可以尝试在 php 代码中先回显动画代码。当 DOM 准备好时,在 .ready()-function 中移除动画。
猜你喜欢
  • 1970-01-01
  • 2010-11-21
  • 2011-05-28
  • 1970-01-01
  • 2011-08-15
  • 1970-01-01
  • 2016-07-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多