Showing a page content at once
I have a website which contains some images in index.php
The problem I am facing is the whole page is not loading at once, I think images are taking some time to load
So what I have done is, I am showing an loading image at first and then after some time I am showing the page, that resolves the problem. But I am curious to know is there any other better way to do this?
I prefer to optimise the hell out of my images.
PNG images
You can use pngcrush to optimise your PNG files for you, but personally I find that once I'm done with it pngcrush only succeeds in making it bigger.
GIF images
Especially for animations, there's a lot of things you can do.
combine
rather than replace
if possible. You will again have problems with transparent areas, but by using combine
you can have each subsequent frame only change the stuff that... changes. This avoids the redundancy of re-writing the entire image if only a small part changes. GIMP has a useful filter "Animation > Optimize for GIF" which will do this for you. Using the above techniques, I once managed to shove 8MB of raw image data into a 125kb animated GIF.
JPG images
JPG is great for photos, but cameras have a tendency to write MASSIVE files.
The above should help you reduce the amount of size taken by your images. Obviously, you should also cache images appropriately, so they only need to be retrieved once. Also make sure that you specify width
and height
on image elements so that the browser can reserve the space for them and avoid jumping around as they load...
And you should be pretty good.
很难说在不知道页面是什么样的情况下可以使用其他选项,但一种选择是为图像预留空间,以便页面文本能够在正确的位置快速渲染,然后稍后加载图像。
链接地址: http://www.djcxy.com/p/18728.html上一篇: angular.js $ scope。$ broadcast,$ scope。$ emit,$ rootScope。$ broadcast使用什么?
下一篇: 一次显示页面内容