View Full Version : Applying filters..
Mhtml
02-09-2003, 11:15 AM
Can someone show me an example of how to apply a blendtrans via javascript to an object.
I have seen it done, somehow they use filters.apply() or something, not sure how though.
TIA :)
brothercake
02-09-2003, 01:49 PM
Transition filters are applied as a transition between two properties; so you have to apply() the filter, change a property of the object, then play() the filter. Like for a fade-in:
<div id="fDiv" style="visibility:hidden;filter:progid:DXImageTransform.Microsoft.Fade()">...</div>
You'd go
var fObj = document.getElementById("fDiv");
fDiv.filters[0].Apply();
fDiv.style.visibility="visible";
fDiv.filters[0].Play();
But remember that - unless you know only IE5.5 SP2 or later will be looking at the page - you have to check for filter support - not just with undefined for non-IE, but also with "unknown" for the first build of IE5.5, which recognises the filter object but doesn't actually support it:
if (typeof fDiv.filters !="unknown" && typeof fDiv.filters[0] !="undefined") { fDiv.filters[0].Apply(); }
fDiv.style.visibility="visible";
if (typeof fDiv.filters !="unknown" && typeof fDiv.filters[0] !="undefined") { fDiv.filters[0].Play(); }
<nb>
but of course, you could just go if(fDiv.filters[0]) ... if you don't care about strict warnings ...
</nb>
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/filter/reference/reference.asp has the full filter reference
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.