Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Returns : *

Returns the property requested. Returns null if it doesn’t exist.


Details

Returns the property requested. For DOM elements, it will check the following properties in this order (and return it as soon as one is found): the element's inline CSS, the element's .getComputedStyle() CSS, a property on the element itself like (element.property), an attribute on the element (like element.getAttribute(property)). Returns null if it doesn’t exist.

You can add a second parameter specifying the unit you’d like it to be returned in if you want.

  1. //get the property in the default unit
  2. gsap.getProperty(target, "width");
  3. gsap.getProperty(target, "backgroundColor");
  4. //or pass in a third parameter to define which unit you'd like it back in
  5. gsap.getProperty(target, "width", "em");
Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×