Page 1 of 1

pgGetStyle() and opacity

PostPosted: Sun Jan 19, 2014 9:18 pm
by Clifton
If you use pgGetStyle() and attempt to get opacity from an object that does not have opacity applied, the this function will return an empty string ( "" ).

Why does this behavior occur?
  • HTML elements apply style.opacity to define the transparency level of an object. The range is 0 (full transparent; basically invisible to the eye) to 100 (full opaque).
  • If an object has no style.opacity property set, the object is considered fully opaque and the opacity setting is null or empty.
  • The PowerPac generally removes the opacity setting for objects with opacity=100 because this fixes a display issue in IE8 browsers where graphics and fonts may appear blotchy.
If you use pgGetStyle() to check the opacity of an object, then you must include logic that handles situations where the function may return "" instead of a predicted integer from 0-100.
EXAMPLE:
Image 2.png
Image 2.png (3.1 KiB) Viewed 1635 times
NOTE: pgGetStyle() will usually return an empty string for objects that are fully opaque (opacity = 100).