www.zambros.it

 

mantis_logo_button


Tuesday 07th of February 2012

Articoli Tecnici

Clicca qui per votare

CSS Effetti opacity
Venerdì 05 Marzo 2010 21:40

Uno degli effetti più semplici e di più impatto e giocare sulla proprietà opacity di un'immagine.

Scopriamo come.

 

Attraverso l'evento javascript onmouseover agiremo direttamente su due immagini, dove imposteremo inizialmente un valore di opacity e successivamente verrà cambiato dal passaggio del mouse:

 

<html>
<head>
<style type="text/css">
img
{
opacity:0.4;
filter:alpha(opacity=40);
}
</style>
</head>
<body>
<h1>Image Transparency</h1>
<img src="/klematis.jpg" width="150" height="113" alt="klematis"
onmouseover="this.style.opacity=1; this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4; this.filters.alpha.opacity=40" />
<img src="/klematis2.jpg" width="150" height="113" alt="klematis"
onmouseover="this.style.opacity=1; this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4; this.filters.alpha.opacity=40" />
</body>
</html>

<html>

<head>

<style type="text/css">

img{

opacity:0.4;filter:alpha(opacity=40);

}

</style>

</head>

<body>
<h1>Image Transparency</h1>

<img src="/klematis.jpg" width="150" height="113" alt="klematis"onmouseover="this.style.opacity=1;

this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />

 

<img src="/klematis2.jpg" width="150" height="113 alt="klematis"onmouseover="this.style.opacity=1;

this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />

</body>

</html>

La sintassi per Firefox è: this.style.opacity=1 per IE è:this.filters.alpha.opacity=100.

Sotto riportiamo l'esempio:

klematis2 klematis

 

 

Aggiungi commento


Codice di sicurezza
Aggiorna

Primo su Google

zetawriter_200
Il primo gestionale SEO online per il posizionamento su Google
Visita www.zetawriter.com

Richiedi subito il tuo preventivo Gratuito al 338.8835425


Twitter



P.IVA: 03864690239 - CF: ZMBMTT82A25A459W - Cell 338 8835425 - info@zambros.it