I won’t post my whole script because it’s most likely irrelevant and will save wasting time.
Why does the following code work:
if (rand === 0)
{
$('#idOfElementInsideContainer')
.animate({padding: ap, background : ab}, {duration:ad})
}
and this not:
if (rand === 0)
{
$('#container:nth-child(1)')
.animate({padding: ap, background : ab}, {duration:ad})
}
I’ve put an alert after the animate line just to prove to myself that it is actually going inside if statement.
Try this instead: