在html页面加载和呈现过程中显示动荡 [英] Showing a throbber during html page load and rendering

查看:54
本文介绍了在html页面加载和呈现过程中显示动荡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面渲染缓慢.网上旅行很快.页面的初始加载很快.您实际上可以看到(如果您的计算机足够慢)html组件的初始布局.然后运行一些javascript内容,使其中的一些组件都变得ajaxy.然后终于应用了CSS.

I have a page that renders slowly. The trip across the net is quick. The initial load of the page is quick. You can actually see (if your machine is slow enough), the initial layout of the html components. Then some javascript stuff runs, making some of those components all ajaxy. Then finally the css gets applied.

对于使所有内容缓慢爬行的javascript,我无能为力.因此,我需要动动脑筋以告知用户保持浏览器正在运行.有什么办法可以捕获浏览器完成的渲染事件吗?甚至有这样的事件吗?还有另一种方法吗?

I can't do anything about the javascript that's slowing everything to a crawl. So I need a throbber to tell the user to hold up, the browser is working. Is there any way to trap the browser is done rendering event? Is there even such an event? Is there another way to do this?

推荐答案

在运行代码之前显示动动功能,然后在其后隐藏动动功能.

Show the throbber before the code is run and hide it after.

使用JQuery:

$("#throbber").show();
/* Your AJAX calls */
$("#throbber").hide();

这篇关于在html页面加载和呈现过程中显示动荡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆