Quantcast
Viewing latest article 17
Browse Latest Browse All 37

Append div from right to left

I have append div with images tag in it without any problem.

What I am having problem right now is how to append div from right to left without affecting so much of my current code, with the same effects. Is it possible to this?

I have tried using cssfloat attribute but no luck on it.

Here is the main loop for my code:

img = '<div id="deck1">'for (var i = 0; i < 9; i++) {    var rand = makeUniqueRandom();    j = rand + 1;    img +='<img id="img'+j+'" src="http://dummyimage.com/64x64/000/fff&text='+j+'" />';           }img += '</div">'$("#deck").append(img);

Demo link for my code:

JSFIDDLE

UPDATE:

What I wanted to do is append images from right to left.

For example:

Current Result is:

1 2 3 4 5 6 7 8 9

Expected Result should be:

9 8 7 6 5 4 3 2 1

Which can also be used for future implementations, which in my end will be adding a second line, thus making the output look like this, because I am planning to add line 10-18 in the 2nd line which will output this way:

9 8 7 6 5 4 3 2 1

18 17 16 15 14 13 12 11 10

That is what I am trying to achieve.

Thank you for your help.


Viewing latest article 17
Browse Latest Browse All 37

Trending Articles