Randomly Position A Div
Posted
by
Connie
on Stack Overflow
See other posts from Stack Overflow
or by Connie
Published on 2012-07-03T09:08:07Z
Indexed on
2012/07/03
9:15 UTC
Read the original article
Hit count: 193
I'm looking for a way to randomly position a div anywhere on a page (ONCE per load).
I'm currently programming a PHP-based fantasy pet simulation game. One of the uncommon items on the game is a "Four Leaf Clover." Currently, users gain "Four Leaf Clovers" through random distribution - but I would like to change that (it's not interactive enough!).
What I Am Trying To Do:
The idea is to make users search for these "Four Leaf Clovers" by randomly placing this image anywhere on the page: (my rendition of a four leaf clover)
I'd like to do this using a Java/Ajax script that generates a div, and then places it anywhere on the page. And does not move it once it's been placed, until the page is reloaded.
I've tried so many Google searches, and the closest thing that I've found so far is this (click), from this question. But, removing the .fadein, .delay, and .fadeout stopped the script from working entirely. I'm not by any means a pro with Ajax. Is what I'm trying to do even possible?
© Stack Overflow or respective owner