Skip to content

Instantly share code, notes, and snippets.

@roachhd
Forked from anonymous/index.html
Created October 17, 2014 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roachhd/9a53ea40128a573ce291 to your computer and use it in GitHub Desktop.
Save roachhd/9a53ea40128a573ce291 to your computer and use it in GitHub Desktop.
<div class="box red"></div>
<div class="box blue"></div>
<div class="box red"></div>
<div class="box blue"></div>
<div class="box red"></div>
<div class="box blue"></div>
<div class="box red"></div>
<div class="box blue"></div>

loop through collection

Loads TweenMax and jQuery to enable the creation of hassle-free demos

A Pen by GreenSock on CodePen.

License.

$(".box").each(function(index, element){
TweenLite.from(element, 0.5, {x:(index+1) * 200, opacity:0, delay: index * 0.2})
})
/* This Pen Loads the Following
jQuery: latest version
TweenMax: latest version
-TweenLite
-TweenMax
-TimelineLite
-TimelineMax
-CSSPlugin
-BezierPlugin
-DirectionalRotationPlugin
-AttrPlugin
-RoundPropsPlugin
-EasePack
*/
body {
font-family:sans-serif;
}
h1 {
margin: 5px 0;
}
h3 {
margin:0;
font-size:16px;
}
.demo {
width:600px;
height:120px;
background-color:black;
}
.box {
width:50px;
height:50px;
position:relative;
margin-bottom:2px;
}
.red {
background-color:red;
}
.blue {
background-color:blue;
}
.nav {
width:600px;
background-color:#ccc;
text-align:right;
}
button {
padding:10px;
margin:10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment