Erik Lydecker
Erik Lydecker

Reputation: 717

Placing a DIV multiple times and with random position

I need to place a div (actually a small image of a cloud) at random positions (as a background). The background should hence have multiple small clouds placed everywhere on the page as a "realistic sky background".

Later on I would try to apply a parallax scroll plugin on those divs .

Thanks!

Upvotes: 1

Views: 497

Answers (1)

Lachezar Todorov
Lachezar Todorov

Reputation: 923

You can use absolute position divs with background image. Just have to change their z-index to negative value or 0 you must test it. And if it does not work try changing the content z-index too, but to higher value.

The absolute position will give you the chance for animating top and left css values.

You can use jquery animations.

Random cords can be asumed by

Math.floor(Math.random()*(maxNumber+1));

Upvotes: 1

Related Questions