Exploring an animation using CSS transitions and jQuery has been my recent project. The concept involves presenting the user with clickable divs to load a new page. When a div is clicked, it expands to cover the entire screen and transition to the next page.
A visual representation of my goal is displayed below:
Initially, I arranged the divs with relative positioning and floated them left to align them. However, upon clicking a div, it would snap to the left side before expanding if it wasn't the first one (blue or green). This behavior was a result of the relative positioning.
position: relative;
You can view an example of this behavior here: http://codepen.io/anon/pen/eKynL
To address this issue, I switched to absolute positioning for the divs. The animation functioned flawlessly as intended, but the downside is that I now have to manually set the left and top positions for each div. Additionally, the divs do not automatically reposition when the window is resized.
position: absolute;
You can see an example of this here: http://codepen.io/anon/pen/jIqcL
I am uncertain if there is a better way to enhance my implementation and make it more maintainable, especially regarding the inline styles for the divs.