English 中文(简体)
Javascript - 大型背景图像装饰时间在Load功能上保持。
原标题:Javascript - Large background image load time is holding up my onLoad function

I have a beautiful background image on a website which unfortunately takes a while to load. The rest of my page is driven by a function that is called when the body loads like so:

<body onLoad="initialise()">
      ...

因此,我的浏览器正在等待背景,在发出初步通知之前全负荷。 如何在网页完全装满负荷之前,或至少在背景图像出现之前,都能够打电话。

感谢你时间:

最佳回答

如果你需要等到网页准备就绪,则用 j子做事。

<script type= text/javascript >jQuery(document).ready(initialise)</script>

这将在图像装上之前进行,但将等待所有的超文本处理。

问题回答

在<代码></one>前添加这一权利:

<script type="text/javascript">initialise();</script>

use jquery s ready() method. if you aren t using jquery, check this out: http://code.google.com/p/domready/ It s a small library just for this work.

如果初步意见不取决于任何页数,那么你就只能把头指向上。

<script type="text/javascript">
    initialise();
</script>

如果初步使用()需要网页内容,则将上述文字放在html网页的底线上,或使用jquery文件。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签