Tried playing around with both of those and not quite there. So annoying that the link I posted does nearly all of what I need apart from centering the content within its container. There must be a way of doing that!
Hmm, I get what you’re saying but maybe there’s no easy way to do it then. Not ideal making those triggers in js.
Unless anyone else can suggest otherwise I may have to rethink things.
You could do the animations with CSS3 but you’d have to set up the logic and triggers with js as in that example you linked to.
The only way I could think of doing something vaguely similar would be to use media queries to change the width (or position) of elements as the window is resized.
Something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
<style type="text/css">
#outer{
width:60%;
margin:auto;
border:1px solid #000;
padding:10px;
overflow:hidden;
-webkit-transition: all 2s ease;
-moz-transition: all 2s ease;
-o-transition: all 2s ease;
transition: all 2s ease;
text-align:center;
}
p{
width:300px;
height:300px;
background:red;
display:inline-block;
margin:20px;
-webkit-transition: all 2s ease;
-moz-transition: all 2s ease;
-o-transition: all 2s ease;
transition: all 2s ease;
}
#outer:hover p{margin:40px}
@media screen and (max-width:1200px) {
p {
width:400px;
height:400px;
background:yellow;
}
}
@media screen and (max-width:1000px) {
p {
width:200px;
height:200px;
background:blue;
}
}
@media screen and (max-width:800px) {
p {
width:100px;
height:100px;
background:green;
}
}
</style>
</head>
<body>
<div id="outer">
<p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
</div>
</body>
</html>