Categories:

JavaScript Kit > IE Filters reference > Here

MaskFilter filter

Last updated: October 28th, 2008

The Mask Filter shows transparent pixels of an object as a color mask, and nontransparent pixels as transparent instead.

Syntax:

filter: progid:DXImageTransform.Microsoft.MaskFilter(attribute1=value1, attribute2=value2, etc);

Syntax (post IE8):

-ms-filter: "progid:DXImageTransform.Microsoft.MaskFilter(attribute1=value1, attribute2=value2, etc)";

Note: See "Difference in syntax between pre IE8 and IE8+ browsers" for more info on the changes to the filter syntax in IE8+.

Example:

<style type="text/css">

#somediv{
width: 90%;
-ms-filter: "progid:DXImageTransform.Microsoft.MaskFilter(color=#000000)";
filter: progid:DXImageTransform.Microsoft.MaskFilter(color=#000000);
}

</style>


<div id="somediv">Some DIV</div>

Syntax via scripting:

//To define a new MaskFilter filter on an element
object.style.filter ="progid:DXImageTransform.Microsoft.MaskFilter(attribute=value1, attribute2=value2)"

To access an existing property within the MaskFilter filter:
object.filters.item("DXImageTransform.Microsoft.MaskFilter").Property1=value1;

//To access an existing property within the MaskFilter filter via the filters[] object
object.filters[x].Property1=value1 //where "x" is the position of the filter within list of filters on element

When getting or setting a specific filter's attribute via scripting, you capitalize the attribute to turn it into a property.

Below lists the attributes/properties of the MaskFilter:

MaskFilter attributes (properties)

Attributes/ Properties Description
Color Read/Write hexadecimal color value that determines the color which is to be made transperant.

Valid values: All valid hexadecimal colors or color names.

Example:

<style type="text/css">

#daisy{
-ms-filter: "progid:DXImageTransform.Microsoft.MaskFilter(color=red)";
filter: progid:DXImageTransform.Microsoft.MaskFilter(color=red);
}

</style>


<img id="daisy" src='daisy.gif' />

enabled Sets/ returns whether the filter is enabled or not. Default is true.

Valid values: true/ false

Reference List

[an error occurred while processing this directive]

CopyRight 1998-2014 JavaScript Kit. NO PART may be reproduced without author's permission.