English 中文(简体)
快速图像负荷
原标题:Faster image loading

我想在我的网页上展示大约5-8个图像,一个图像是一张图像,但我希望这些图像能够先上载,而不是每次把图像上调。

我看到了一些例子,他们在网页上有所有图像(隐藏),例如:

<a href=""><img id="img1" src="images/image1.png" class="image" alt="" /></a>
<a href=""><img id="img2" src="images/image1.png" class="image" alt="" /></a>
<a href=""><img id="img3" src="images/image1.png" class="image" alt="" /></a>

the弄目前的形象。

我有一个形象,即改变这种形象,使新形象从阵列走。

SwitchNextImage: function(){    
   var theimg=document.getElementById("imgContainer");                  

   this.currentIndex = this.currentIndex+ 1 == this.totalImageCount ? 0 : this.currentIndex + 1;
   theimg.src=this.slideimages[this.currentIndex].src;          
}

The first method is obviously faster loading. But requies static links.
My questions is how can I make my method more faster loading?

最佳回答

页: 1

问题回答

你们应当看一看图像预载。 你们可以通过 j子实现你们想要的东西,为每个形象树立一个新的形象:

var img = new Image();
img.src = "image2.png";

这样一来,你就把主形象的<条码><>>src转换成,浏览器就可以从海滩上取出。 回答你们的所有形象,应当确定。

我以前曾有过一个问题,即我的形象gal将只是每次冻结随机照片。 我尝试了这两件事,我制作了一个装满图像的 custom版,并尝试了光箱图书馆。 速度没有任何差别。 这两起案件的图像都很缓慢。

I looked it up and found out that the cause to slow loading is probably.
- Slow internet connection.
- Image size/format. (jpg is recommended for photos)

因此,我进行了一些研究,我提出了一份简单的解决办法:。 在优化网络时,总部照片的装载速度加快。 可以通过照片店这样做。

在优化照片后,质量保持了很高,我的包裹正在即时装上。





相关问题
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!