Skip to content

Instantly share code, notes, and snippets.

@dospuntocero
Created October 1, 2019 02:43
Show Gist options
  • Save dospuntocero/3f327eddc95bce14b94a8996ccbd10fc to your computer and use it in GitHub Desktop.
Save dospuntocero/3f327eddc95bce14b94a8996ccbd10fc to your computer and use it in GitHub Desktop.
gsap slideUp/slideDown functionality
body{
background-color:black;
height:100%;
margin:10px;
}
.box{
position:relative;
width:100px;
height:100px;
color:black;
font-size:30px;
line-height:100px;
text-align:center;
background: #9af600;
overflow:hidden;
}
<div class="box" id="box1">GSAP</div>
<button>slide</button>
var t = TweenLite.to("#box1", 0.5, {height:0, paused:true, reversed:true});
$("button").on("click", function() {
if (t.reversed()) {
t.play();
} else {
t.reverse();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment