I have a load of images overlapping, I just done this by giving a css style of margin:0 -20px 0 -20px;. They overlap the one on the left and the one above, its to unioform looking. Is there any way to use js/jquery to give a class a random z-index?
I dont have a moment right now to do some testing with this concept... in the meantime, with the samples you tried, did you look at the source code to see if in fact, the styles are being applied? did you check with any browser dev tool?
Ok, so as I mentioned in my first response, you need to loop through the elements and apply a random z-index value to each. I took a look at your example and put something together which you should be able to work from.
Here is a screenshot from Chrome's Dev tool showing that random z-index's were applied...
If you look at the script block, all that it is doing is looping through each of the elements that are assigned the class of "nailthumb-container". Then we assign the random z-index to the current item within the loop. The loop continues until all items are evaluated.