Solved

Loading gifs problem

Posted on 2002-07-30
13
124 Views
Last Modified: 2010-04-09
Hi,

I have a page wherein I am building a MenuTree (like windows explorer). Each node(eg + symbol) has a small icon sort of gif attached to it.

In order to avoid the loading timing of the tree to be less, I have written a function wherin I preload the gif images in javascript image objects.

Also Since there are only 15 gif files, what i think is whenever same gif file is being referenced the browser should not start downloading the gif files if they have already been referenced in the tree. But i can see in the status bar it tries to download gif files again and again.

This is giving me a performance problem during onload of the tree.

I have used a Img src property for the gif.

Can anyone help ?

Pankaj
0
Comment
Question by:Pankaj27
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 14

Expert Comment

by:avner
ID: 7187824
Are you using webfx xtree?
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7187861
No, its a normal tree prepared from html objects
0
 
LVL 14

Accepted Solution

by:
avner earned 50 total points
ID: 7187871
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7187902
No it is not a webfx tree. But i had a look at the URL u have send me avner. Its almost similar code. But if there is a lot of data it takes about 1 minute to load the tree and all that time browser is trying to download the images.
0
 
LVL 14

Expert Comment

by:avner
ID: 7187905
how have you implemenetd the images in the tree nodes ?
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7187908
as an image tags. i.e <img scr=
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:avner
ID: 7187927
I made a small test , as I saw first time you load the page it always load one by one, while in the next time it gets the images from cache and not one by one :

function createImagesExample()
{
     var oImg=document.createElement("IMG");
     oImg.src = "http://www.experts-exchange.com/images/kp_logo2.gif";

     var max =100;
     var doc = document;
     var oBody = doc.body;

     for (var i=0; i< max ; i++)
               {
               /*var oImg2 = doc.createElement("IMG");
               oImg2.src =  oImg.src*/
               oBody.appendChild(oImg.cloneNode());
               }


}
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7188016
Thanks avner,

I ran ur code on my machine..first time it gave me downloading images 100 times. Next time it didnt. This is since the entry for the image went in the cache. But on the machine.. i am trying to run, the image is not going in the cache, so its downloading again.

Pankaj
0
 
LVL 14

Expert Comment

by:avner
ID: 7189672
I am not sure I understand your last sentece, what is the situation in your case in the second case ? are you using same method as I did to load the images ?

In my example there are two different methods, one of them is commented, it behaves exactly as the firts one, you might want to try that approach.
0
 
LVL 1

Author Comment

by:Pankaj27
ID: 7189948
In fact its that approach which i am using in my code. That is doing an <img src> . I have also tried doing a clone node but did not improve the performance. I will paste the code soon as soon as I am out of the meeting.

Thanks Avner,
Regards
Pankaj
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7271019
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7403209
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to avner

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7431201
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Modify Table Width 6 22
gif banner animation loads randomly in mobile 3 82
Split in Javascript 5 30
Zoom the page when you go in from your phone 3 10
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

911 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