EDIT: codepen.io/TechTime/pen/ZKdxQK this is my project. As you can see for each class one of the divs does an animation. I want ALL divs to do an animation from the list. As in, here my code tries to give each div a unique class. I want it so that some divs can have the same class and thus all receive an animation.
I want to have a list of classes and one is chosen randomly, which is then assigned to one of many divs with the same id.
So far i have been able to achieve it to the point that it gives the class to one of those divs but if x classes are in the list then only x divs get a class.
I have more divs than classes. How do I solve my problem?
Below is my code so far:
$(document).ready(function() {
var klasses2 = [
"animated bounce",
"animated flash",
"animated pulse",
"animated rubberBand",
"animated shake",
"animated headShake",
"animated swing",
"animated tada",
"animated wobble",
"animated jello",
"animated bounceIn",
"animated bounceInDown",
"animated bounceInLeft",
"animated bounceInRight",
"animated bounceInUp",
"animated bounceOut",
"animated bounceOutDown",
"animated bounceOutLeft",
"animated bounceOutRight",
"animated bounceOutUp",
"animated fadeIn",
"animated fadeInDown",
"animated fadeInDownBig",
"animated fadeInLeft",
"animated fadeInLeftBig",
"animated fadeInRight",
"animated fadeInRightBig",
"animated fadeInUp",
"animated fadeInUpBig",
"animated fadeOut",
"animated fadeOutDown",
"animated fadeOutDownBig",
"animated fadeOutLeft",
"animated fadeOutLeftBig",
"animated fadeOutRight",
"animated fadeOutRightBig",
"animated fadeOutUp",
"animated fadeOutUpBig",
"animated flipInX",
"animated flipInY",
"animated flipOutX",
"animated flipOutY",
"animated lightSpeedIn",
"animated lightSpeedOut",
"animated rotateIn",
"animated rotateInDownLeft",
"animated rotateInDownRight",
"animated rotateInUpLeft",
"animated rotateInUpRight",
"animated rotateOut",
"animated rotateOutDownLeft",
"animated rotateOutDownRight",
"animated rotateOutUpLeft",
"animated rotateOutUpRight",
"animated hinge",
"animated jackInTheBox",
"animated rollIn",
"animated rollOut",
"animated zoomIn",
"animated zoomInDown",
"animated zoomInLeft",
"animated zoomInRight",
"animated zoomInUp",
"animated zoomOut",
"animated zoomOutDown",
"animated zoomOutLeft",
"animated zoomOutRight",
"animated zoomOutUp",
"animated slideInDown",
"animated slideInLeft",
"animated slideInRight",
"animated slideInUp",
"animated slideOutDown",
"animated slideOutLeft",
"animated slideOutRight",
"animated slideOutUp",
];
klasses2.sort(randOrd);
$("#zewrapper #tris").each(function(i, val) {
$(this).addClass(klasses2[i]);
});
});