J.R. wrote:
>
> Integralist wrote:
>>
>> Hi,
>>
>> I've been struggling with the emilejs animation library for hours 
>> now. I've tried contacting the author regarding modifying the library but 
>> I've had no response and I'm at my wits end trying to figure out how to do 
>> what I need it to do.
>>
>> The library can be found here: https://github.com/madrobby/emile
>>
>> I've discovered that the animating of the opacity setting for an element 
>> only works for browsers that support it and for Internet Explorer it 
>> requires filter:alpha(opacity=0); but I just can't work out how to extend 
>> the script to support this?
>>
>> Any help would be greatly appreciated.
>>
>>
> I've got a generic setOpacity() function which you can use:
>
> function setOpacity(el, val) {
>   var w3cVal = val / 100;
>   if (el.filters) {
>     // avoid IE's bug: normal zoom will force element's
>     // hasLayout prop equals -1 (true).
>     if (!(el.currentStyle.hasLayout)) { el.style.zoom = 1; }
>     el.style.filter = "alpha(opacity=" + val + ")";
>   } else {
>     el.style.opacity = w3cVal; // W3C browsers.
>     //el.style.MozOpacity = w3cVal; // Older Mozilla and Firefox versions.
>     //el.style.KHTMLOpacity = w3cVal; // Safari<1.2, Konqueror.
>   }
> } 
>
> After setting opacity for a text element in IE back to 100, you'll have to 
> fix the clearType bug:
>
> // some code
> setOpacity(elemTxt, 100);
> // Fix IE's clearType bug
> if (elemTxt.filters) { elemTxt.style.removeAttribute('filter'); }
>

 Just complementing, Thomas Fuchs (the author of emile.js) recommends not to 
use Opacity during a presentation at Fronteers 2009:
<http://fronteers.nl/congres/2009/sessions/roll-your-own-effects-framework>

"Reduce the amount of nodes (HTML elements and text nodes) and avoid using 
the “opacity” CSS property." (slide 65 and video at 33:40)

Cheers,
Joao Rodrigues (JR)

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to