Оптимизируйте предварительную нагрузку JavaScript изображений

RGB: 255, 255, 255 - это код цвета для WHITE. Так как цвет фона вашего родительского макета также белый, вы не увидите разницу.

Попробуйте изменить цвет, например

backgroundImg.setBackgroundColor(Color.rgb(100, 100, 50));

Или измените цвет фона родительского макета.

6
задан Bryan M. 6 June 2009 в 15:49
поделиться

5 ответов

As you pointed out - one of the most common factors that influences load times for modern web pages are the huge number of small images being sent between the client and server. Some recent studies indicate that for more than 20 images, 80% of your load time is going to be spent in the latency of doing these many gets, not actually doing the downloading!

A tool called SmartSprites is a very handy way to "compile" a single large image from all of your many little images which will accomplish both much faster load times and the prefetching of images. Here's the link http://smartsprites.osinski.name/

4
ответ дан 17 December 2019 в 02:33
поделиться

I would say using CSS sprites is a big one. Having all your images, or images of a similar nature come down on the one HTTP request really helps load time. Downloading 10 images with a total file size of 100kb is going to be slower than downloading 1 image the same size. It also helps images come down before they are required in the case of hovers and mouse over events and they generally make things a lot smoother.

Here is an article on them.

1
ответ дан 17 December 2019 в 02:33
поделиться

If you don't need all the images right away, you can use the window.timeout() function to do some of the work after the page has initialized.

Also, if you use one image in multiple places, you can avoid multiple calls to the server by putting the image into a CSS style and reusing that style instead of the image.

0
ответ дан 17 December 2019 в 02:33
поделиться

Using a sprite is good if you're OK with that solution. Also, what I'd try is to detect data URI support in that browser and have the script load different stylesheets base on that info. One stylesheets with base 64 encoded data URIs and the other with a real URL to the sprite. The CSS file is also cacheable.

Here's a technique to detect data URIs support or you could use IE conditional comments or... there are some workarounds for sending IE encoded image strings, in multipart HTTP responses.

1
ответ дан 17 December 2019 в 02:33
поделиться

Используйте Sprite Me . И не пропустите блог сообщения о создании этого инструмента.

0
ответ дан 17 December 2019 в 02:33
поделиться
Другие вопросы по тегам:

Похожие вопросы: