
Originally Posted by
scott1964
The last thing I though would be nice would be to have each element's entry staggered a bit. So, within my .slide container div, I have various elements all with a class="animElement". I would like each one to do it's CSS slide right after the one in front of it in the queue. When the "slide" loads the first element <h1> will slide ... then each <p> tag will slide in, then the <img> ... basically whatever I gave the class animElement to.
This is to simulate what you sometimes see in PowerPoint where the items do a similiar transition.
I actually built a presentation like that not long ago, but I cheated and used DeckJS 
If you want to do that, I would recommend using CSS animations and some default classes to set up delays and durations.
For example:
Code css:
.delay0-1 { -webkit-transition-duration: 0.1s; }
.delay0-2 { -webkit-transition-duration: 0.2s; }
.delay0-3 { -webkit-transition-duration: 0.3s; }
.duration0-1 { -webkit-transition-duration: 0.1s; }
.duration0-2 { -webkit-transition-duration: 0.2s; }
.duration0-3 { -webkit-transition-duration: 0.3s; }
NOTE: This code is from an app I'm building for iPad use, so I'm only using the -webkit- prefix. If you want to cater to more browsers you should of course consider putting all the prefixes in!
e.g.
Code css:
.duration0-1 {
-webkit-transition-duration: 0.1s;
-moz-transition-duration: 0.1s;
-ms-transition-duration: 0.1s;
-o-transition-duration: 0.1s;
transition-duration: 0.1s;
}
Now all you need is some classes that perform the transitions, for example:
Code css:
.slide-in {
position:relative;
-webkit-transition-property: left;
-webkit-transition-timing-function: ease-out;
left:100%;
}
.animate-in .slide-in {
left:0%;
}
Note the .animate-in class? We need this to represent a different state than the initial one. There are various ways of accomplishing this, and I think this one might work for you. We just need to add an "addClass()" call to your callbacks.
Code javascript:
//replace the $child.animate() call with this in each of your callbacks
$child.animate({left: '0%'}, 1000).addClass("animate-in");
You can then use a combination of these classes to animate your content
HTML Code:
<div class="slide">
<h1 class="slide-in duration0-3">Heading</h1>
<p class="slide-in delay0-1 duration0-5">Para 1</p>
<p class="slide-in delay0-5 duration0-5">Para 1</p>
<p class="slide-in delay0-9 duration0-5">Para 1</p>
</div>
You can of course do all of these animations in JavaScript as well, and if you need to support more than just the latest browsers, then that's something that isn't too hard to do either
Bookmarks