O
oeyvind toft
I`m writing a pattern machine in JS.
I use small (20-50px) dynamicly created divs (100-200) and use loops to
place them
in predefined patterns. I assign style props to them at creation time.
Problem:
When assigning a background image to the style object of the divs, it takes
10 - 12 seconds before
they are displayed on screen. For now I`ve used the same image (2kB) for all
divs.
It looks something like this:
var src = "url(someImage.jpg)";
for(var i = 0; i < arrayDivs.length; i++)
{
myDiv.style.backgroundImage = src;
}
I have a medium fast machine and the testing is done locally.
I would very much like to have this work faster.
If you know any tricks that can be used to speed up the process please
inform me.
Oeyvind
I use small (20-50px) dynamicly created divs (100-200) and use loops to
place them
in predefined patterns. I assign style props to them at creation time.
Problem:
When assigning a background image to the style object of the divs, it takes
10 - 12 seconds before
they are displayed on screen. For now I`ve used the same image (2kB) for all
divs.
It looks something like this:
var src = "url(someImage.jpg)";
for(var i = 0; i < arrayDivs.length; i++)
{
myDiv.style.backgroundImage = src;
}
I have a medium fast machine and the testing is done locally.
I would very much like to have this work faster.
If you know any tricks that can be used to speed up the process please
inform me.
Oeyvind