Solved

increase website page load time - lots of images

Posted on 2012-03-13
4
211 Views
Last Modified: 2012-03-20
i have a webpage that has a lot of images.

what is the best way to increase page load speed with all of them.

here is the link:
http://galstanward.com/before-after-photos.html

thanks
0
Comment
Question by:webdott
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
nap0leon earned 500 total points
Comment Utility
Only the first row of images need to be loaded initially (OK, maybe the first two rows for high resolution large screen monitors).
All of the others are "below the fold" and can be loaded later.

A couple minor changes to your page...

1- add jQuery to your HEAD section
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" ></script>

Open in new window


2- for every image that you want to delay the load:
change imgs like this:
<img alt="" src="before-after-photos_files/28.png" height="312" width="950">
<img alt="" src="before-after-photos_files/4.png" height="312" width="950">

Open in new window


to this:
<img alt="" src="" height="312" width="950" id="28">
<img alt="" src="" height="312" width="950" id="4">

Open in new window


And add the code that makes those IMG tags actually have an image in them.:
<script type="text/javascript" >
	$(document).ready(function(){
		$("#28").attr("src","before-after-photos_files/28.png");
		$("#4").attr("src","before-after-photos_files/4.png");
	})
</script>

Open in new window


The whole page won't load "faster", but if you only make the page load the first row of images "right away" the user will still see the first images right away and by the time they start scrolling, the other images should be loaded.
0
 
LVL 20

Expert Comment

by:Proculopsis
Comment Utility
0
 

Author Comment

by:webdott
Comment Utility
thanks.

i am going to try napOlean's response first, then will look at the lazy-loading.
0
 

Author Closing Comment

by:webdott
Comment Utility
thanks

i have tested this and will be using it on the website.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now