Jump to content
Search Community

CSSPlugin and height

marten test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

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

Link to comment
Share on other sites

This is interesting.. look at this codepen demo, view in Chrome or Safari:

 

See the Pen yyvLKa by jonathan (@jonathan) on CodePen

 

You will notice that column 1 (blue box) height property will get overridden by -webkit-logical-height

 

The column 2 (green box) uses the regular height property due to having the !important declaration.

 

Looks like -webkit-logical-height will override the normal height property regardless of order in the CSS rule, also if it is inline.. unless the !important declaration is used.

 

Also looks like this might have to do with CSS3 Writing Modes

 

http://www.w3.org/TR/css3-writing-modes/

http://www.w3.org/TR/css3-writing-modes/#abstract-dimensions

 

:)

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...