Jump to content
Search Community

marten

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by marten

  1. Hi,

     

    I have a problem toggling the height of an object using the CSSPlugin. Transitioning by adding a class works, removing the class however does not result in the previous height.

    .box {
      height: 50px;
      width: 50px;
      background: red; 
    }
    .active {
        height: 80px;
        background: blue;
     }
    
    var toggle = function () {
      var square = document.querySelector('.box');
    
      if (square.classList.contains("active")) {
        TweenMax.to(square, 1, {className:"-=active"});
      } else {
        TweenMax.to(square, 1, {className:"+=active"});
      }
    }
    
    

    Or take a look at the codepen URL.

     

    Any ideas?

     

    Best,

    Marten

    See the Pen bNLbQQ by anon (@anon) on CodePen

×
×
  • Create New...