goutte

Ajouter de la transparence

Ou comment faire joujou avec le channel alpha

transparence javascript, javascript transparence, javascript alpha, alpha javascript, not provided

Cette fonction ajoute de la transparence sur un élément html (div, img ...).
elementId : Identifiant de l'élément
alpha : entier entre 0 et 100 (100 totalement transparent)


function setAlpha(elementId,alpha)
{
document.getElementById(elementId).style.opacity = alpha / 100;
/** Test pour notre cher IE */
if (document.body.filters != undefined)
{
document.getElementById(elementId).style.filter = 'alpha(opacity:' + alpha + ')';
}
}

Image : graylight

 
 

b1n@sp1n