Thank You Eric, it looks intresting and much more flexible, but it's to complex for me in this case.
What I'm thinking on is, for example: - chain the whole DOM node creation process or - create a jQuery function or - ... So just an easy one to understand the "way of life" in jQuery :] On Jun 26, 5:07 pm, Eric Garside <gars...@gmail.com> wrote: > I put together a plugin to handle this kind of thing that does okay in > most browsers, called replicator. Give that a shot and see if it helps > making your life any easier. > > http://eric.garside.name/docs.html?p=replicator > > On Jun 26, 10:11 am, chronotype <thund3rb...@gmail.com> wrote: > > > Hello, > > > i've created a function to generate user defined number of an image. > > I'm sure that it's not the optimal solution, because over 100 elements > > most browsers renders it very slow... > > > Here is the sample page:http://resolution.capsule.hu/(the× image is > > randomly generated) > > > The js function: > > > function exRandomizer(param,maxDim,transp) { > > var x = $('body').width() - maxDim; > > var y = $('body').height() - maxDim; > > > for ( var i = 0; i < param; i++ ) { > > var dim = Math.round(Math.random() * maxDim); > > > $('#container').before('<img src="static/images/ex.gif" > > alt="" > > class="eX" id="eX_' + i + '" />'); > > > $('#eX_' + i) > > .css({ > > opacity: transp, > > zIndex: 1, > > top: Math.round(Math.random() * y) + 'px', > > left: Math.round(Math.random() * x) + 'px', > > width: dim + 'px', > > height: dim + 'px' > > }); > > } > > return false; > > > } > > > and you can call it for example: exRandomizer(100,250,0.1); > > > I would be very happy, if someone could post a more optimal version - > > it's very useful, and I think many of beginner jquery users could > > learn a lot form an example. > > > Thanks in forth! > > > { csongor }