Created
October 1, 2019 02:43
-
-
Save dospuntocero/3f327eddc95bce14b94a8996ccbd10fc to your computer and use it in GitHub Desktop.
gsap slideUp/slideDown functionality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="box" id="box1">GSAP</div> | |
<button>slide</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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