473,785 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading images

I have recently looked at http://alistapart.com/articles/imagegallery
to implement a simple picture gallery on a webpage that I'm working on.

Everything works fine; however, I have one question. When I click on a
thumbnail, a JavaScript function is executed to change the picture in
the main view. Since some of these images are around 300KB, it takes up
to a couple of seconds to load the image. In Internet Explorer, one can
see the image loading and filling the screen. In Firefox or Opera, the
old image stays displayed until the new image is fully downloaded, and
only then the new image appears in its entirety. This is somewhat
annoying, because sometimes a new caption already appears, and the
viewer is still looking at the the old picture until the new one is
fully downloaded.

Is there anyway to do it so that also in Firefox and Opera, one will
see the new image as it is gradually loading? (as it happens if it was
loading directly from a HTML link, without using the JavaScript
function?)

Thanks,

Ivan

Aug 19 '06 #1
6 2566
For your reference, the gallery is here:
http://www.princeton.edu/~puttc/gallery.htm

If it's not possible to have Firefox and Opera "get rid" of the old
image as the new one is being loaded, would there be a way to implement
an onload event on the picture, and therefore the caption would only be
displayed once the picture is loaded?

Thanks,

Ivan

Aug 20 '06 #2

Ivan Bútora wrote:
I have recently looked at http://alistapart.com/articles/imagegallery
to implement a simple picture gallery on a webpage that I'm working on.

Everything works fine; however, I have one question. When I click on a
thumbnail, a JavaScript function is executed to change the picture in
the main view. Since some of these images are around 300KB, it takes up
to a couple of seconds to load the image. In Internet Explorer, one can
see the image loading and filling the screen. In Firefox or Opera, the
old image stays displayed until the new image is fully downloaded, and
only then the new image appears in its entirety. This is somewhat
annoying, because sometimes a new caption already appears, and the
viewer is still looking at the the old picture until the new one is
fully downloaded.

Is there anyway to do it so that also in Firefox and Opera, one will
see the new image as it is gradually loading? (as it happens if it was
loading directly from a HTML link, without using the JavaScript
function?)
If you have only a few large images, perhaps preloading them would
help. You might put some text at the top of the page to hopefully keep
the viewer busy while images are being preloaded. If you have many
large images that are likely to be selected at random, there would seem
to be little you can do. On your example page, I see no problem,
because the large images load so rapidly on clicking. However I am
using DSL broadband that downloads at over 5 Mbps from my site.

Aug 20 '06 #3

Ivan Bútora wrote:
For your reference, the gallery is here:
http://www.princeton.edu/~puttc/gallery.htm

If it's not possible to have Firefox and Opera "get rid" of the old
image as the new one is being loaded, would there be a way to implement
an onload event on the picture, and therefore the caption would only be
displayed once the picture is loaded?
It might be possible to modify code so that, when you click for a large
image, the caption of the old image is at once hidden by switching
visibility to hidden. This would require that all of the captions have
a unique id associated with each so that the clicking of the desired
image could get to the title using document.getEle mentById to switch
visibility from visible to hidden.

Aug 20 '06 #4
cwdjrxyz wrote:
Ivan Bútora wrote:
For your reference, the gallery is here:
http://www.princeton.edu/~puttc/gallery.htm

If it's not possible to have Firefox and Opera "get rid" of the old
image as the new one is being loaded, would there be a way to implement
an onload event on the picture, and therefore the caption would only be
displayed once the picture is loaded?

It might be possible to modify code so that, when you click for a large
image, the caption of the old image is at once hidden by switching
visibility to hidden. This would require that all of the captions have
a unique id associated with each so that the clicking of the desired
image could get to the title using document.getEle mentById to switch
visibility from visible to hidden.
OK, thanks - I guess I can start playing around to implement some sort
of "Please wait while the picture is loading" message in place of the
caption of the old image - I'll have to do some reading on that, since
I'm sort of learning JavaScript "on the spot".

I was just wondering why Internet Explorer seems to do this differently
from Firefox and Opera. If the latter two behaved like IE in this
particular situation, I would not have the need to put in any extra
code, because with IE, the old image disappears once the new one starts
downloading. I guess on your 5 Mbps connection none of this matters. I
have what I consider a pretty fast connection here, but some of the
larger images took up to four-five seconds to load, which is what I can
probably expect in case of people with DSL or cable connections.

Ivan

Aug 20 '06 #5

Ivan Bútora wrote:
cwdjrxyz wrote:
Ivan Bútora wrote:
For your reference, the gallery is here:
http://www.princeton.edu/~puttc/gallery.htm
>
If it's not possible to have Firefox and Opera "get rid" of the old
image as the new one is being loaded, would there be a way to implement
an onload event on the picture, and therefore the caption would only be
displayed once the picture is loaded?
It might be possible to modify code so that, when you click for a large
image, the caption of the old image is at once hidden by switching
visibility to hidden. This would require that all of the captions have
a unique id associated with each so that the clicking of the desired
image could get to the title using document.getEle mentById to switch
visibility from visible to hidden.

OK, thanks - I guess I can start playing around to implement some sort
of "Please wait while the picture is loading" message in place of the
caption of the old image - I'll have to do some reading on that, since
I'm sort of learning JavaScript "on the spot".

I was just wondering why Internet Explorer seems to do this differently
from Firefox and Opera. If the latter two behaved like IE in this
particular situation, I would not have the need to put in any extra
code, because with IE, the old image disappears once the new one starts
downloading. I guess on your 5 Mbps connection none of this matters. I
have what I consider a pretty fast connection here, but some of the
larger images took up to four-five seconds to load, which is what I can
probably expect in case of people with DSL or cable connections.
There is a low-tech method that has nothing to do with script that
likely could solve your problem. Make the caption part of the image.
Just take each image to PaintShop or some other like program. Enter a
background color you like and add the image. Then enter the caption
text and place it anywhere you like. Then crop to include the amount of
background area you want around the image that includes room for the
caption added. Output as jpg or any of several other formats. I can do
this simple editing very rapidly, but there is a learning curve if you
use such a program for the first time.

Aug 21 '06 #6
It might be possible to modify code so that, when you click for a large
image, the caption of the old image is at once hidden by switching
visibility to hidden. This would require that all of the captions have
a unique id associated with each so that the clicking of the desired
image could get to the title using document.getEle mentById to switch
visibility from visible to hidden.
I was able to write some code in the end which shows a blinking wait
message while the picture is loading, and the caption loads only after
that.

Anyway, thanks for your help.

Aug 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3387
by: Stacey | last post by:
Hi, I'm hoping for a bit of advise-- I have a (relatively, from the point-of-view of this dilettante) complex script that attempts to preload certain images in order to trigger one of a series of six slideshows (rather than try to articulate, have a look here): http://www.slack.net/~stacey/stestbed/homejs.jsp Clicking any of the six blocks of text along the sides will begin a loop of the corresponding slideshow.
4
3748
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just did a preload script. But then the user has to sit for 5 minutes waiting for 63 images to download! My images are about 640x480 and average 100kb. Is this too much for one page to load? Should I load my slideshow into differerent windows? If so,...
15
2336
by: Geoff Cox | last post by:
Hello I have following type of code in the header function pre_load_pics() { if (document.images) { var image1 = new Image(400,265); image1.scr = "pic1.jpg";
4
1621
by: VR | last post by:
Hi, I am trying to have a menu item (which is an HTML img) to change as a mouse moves over it. So, my code looks something like this: <a onmouseover="ActivateImage('MyImage');" onmouseout="InactivateImage('MyImage');" href="javascript:void(FollowLink('MyImage'));">
2
2995
by: Jean Pierre Daviau | last post by:
When I have something like this in a js file. listeImg = new Array(); listeImg = new Image(w,h); listeImg.src = "centre1.jpg"; etc Are the images loaded after the page is loaded? In the same time? Before the page is loaded? The browser decision? If the visitors goes, before the procedure is over, to another page having a link to the same js file, will the other page allows for the rest of the
0
2205
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and incurred a network hit per image file. i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
1
3407
by: agatha.life | last post by:
I did a javascript for the loading of images (I didn't want to have the images loaded in "on loading" because they are too many). The website is for a model and if you look at the codeof pages ( for ex. http://www.agathamoon.com/gallery_48_eng.htm ) using explorer or firefox it works, with safari it doesn't! :( The idea is to have the word "loading" appearing while going from an image to another.
3
2590
jeremydowe
by: jeremydowe | last post by:
Hi, I have noticed that quite a few websites use a preloading graphic (i.e spining circle) to show the that the site is loading images while the user waits. How can I add this to my website? At the moment, i have a request after click on a thumbnail which loads an image below using the innerHTML property. For example:
1
1920
by: mlikesit | last post by:
I am trying to get the following code to pre-load some images before re-dirrecting the user. The problem is that the onError event gets called for all of the images immediately. I've tripple checked that the images do in fact exist at the specific url, so I can't figure out why the onError is being called. The script is currently posted on http://www.mkcustomdesign.com/index.html. <script type="text/javascript"> var imagesToLoad = 0;...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.