Solved

Loading gifs problem

Posted on 2002-07-30
13
126 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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
 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

828 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