Hi,

At first I'm very sorry for my english. If any sentence or word is a
little bit confusing, just ignore it.

The Problem:
I have to refresh a background-image of a <div> element every x
seconds. It's a image which is generated of a PHP Script, so the image
changes. Unfortunately there were flickering effects. So I had to
write an workarround, and really it works. It does what I want,
but ....

I have uploaded it: You can see it under: http://www.webraid.de/test/forum.html
(best with Firebug).

My Problem is in this Code Segment:

                $("#"+options['dummybild']).load( function()
                {
                                if(!flag)
                                {
                                                console.log("Ready Loading");
                                                
container.css("background-image",'url("'+turl+'")'); // Setting
the bg-image
                                                //flag=true;
                                                // return true;
                                }
                });

It runs in a loop. Firebug logs many "Ready Loading". When the x time
my function is called, then x times Firebug logs "Ready Loading". So
when the script is running 1minute and every 3seconds the function is
called, then there are 20 "Ready Loading" for the 20. calling.  Not
optimal, not my goal, even though it works.

And now my question ? Why ? How can i left this loop of the
load(function()...). return does not help. A flag for only one time
setting the background and logging isn't the solution.

Thanx a lot

Faenôl

Reply via email to