How can I append a div layer to another that uses jquery .animate function?

I have an attached file and would like to append the green box (div layer). To the top of the id="box" gray div layer. So every time the box moves or animates to it's position of x or y that the green box always lays directly centered over the gray div layer touching the gray box.

Thank you,

Who is Participating?
Try the below code.
it was placed inside the grey box with absolute positioning, and an extra 50px padding-top was added to the box to accommodate it then finally in order to get rid of the extra grey color, another white absolute div was placed behind the green box to give the final effect, this was all done through CSS

There would be another approach using a different structure where you can create another container, position the green box in it then the grey box under and apply the effect on the main container, but I thought the CSS would be better.

brihol44Author Commented:
Thanks, that worked!
brihol44Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.