javascript - jQuery toggle with gsap animation -


i want toggle div add height 10px 200px.. problem if click again animate 200px 10px. , dont know do.

heres code.

the css

.container2 {   width: 100%;   height: 10px;   border: 1px; } .container .box {   padding: 10px;   margin: 10px;   background: blue;   display: none; } 

the html

<div class="container2">     <div class="box bouncein"></div> </div> 

the javascript

var con = $('.container2'); var box = $('.box'); var click = $('.click');  click.click( function() {    tweenmax.to(con, 1, {height: '200px', ease:bounce.easeout}); }); 

this code toggle , forth between 2 states.

var clicked = false; click.click(function() {     if(clicked){         tweenmax.to(con, 1, {height: '10', ease:bounce.easeout});    }else{         tweenmax.to(con, 1, {height: '200', ease:bounce.easeout});    }    clicked = !clicked; }); 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -