salve.
avrei bisogno di uno script molto semplice e leggero per la dissolvenza di un div che contiene del testo. sapete consigliarmi qualcosa che non utilizzi i soliti framework?
mille grazie
salve.
avrei bisogno di uno script molto semplice e leggero per la dissolvenza di un div che contiene del testo. sapete consigliarmi qualcosa che non utilizzi i soliti framework?
mille grazie
"homer sei tonto come un mulo e due volte più brutto. se uno sconosciuto ti offre un passaggio tu devi accettarlo..."
www.flickr.com/photos/asciella/
www.lastfm.it/user/qvaioe/
Prova questo, ma prima controllalo:
codice:function opacity(id, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; var self = this; //determine the direction for the blending, if start and end are the same nothing happens if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac("+i+",'"+id+"')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { document.getElementById(id).style.display='block'; for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac("+i+",'"+id+"')",(timer * speed)); timer++; } } }; function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; };![]()
Cavicchi Andrea
Problemi con javascript, jquery, ajax clicca qui
perfetto, grazie mille.
purtroppo però non funziona con ie. quale potrebbe essere il problema?
posto lo script che ho leggermente modificato
grazie milleCodice PHP:
function opacity(id, opacStart, opacEnd, millisec)
{
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
var self = this;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd)
{
for(i = opacStart; i >= opacEnd; i--)
{
setTimeout("changeOpac("+i+",'"+id+"')",(timer * speed));
timer++;
}
}
}
function changeOpac(opacity, id)
{
if (document.getElementById(id))
{
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
if (opacity==0) document.getElementById(id).parentNode.removeChild(document.getElementById(id));
}
}
function nascondi_avvisi()
{
var span=document.getElementsByTagName("span");
for (var i=0;i<span.length;i++)
{
if (span[i].id.indexOf("avviso")!=-1)
{
setTimeout("opacity('avviso" + (i+1) + "',100,0,2000)",4000);
}
}
}
"homer sei tonto come un mulo e due volte più brutto. se uno sconosciuto ti offre un passaggio tu devi accettarlo..."
www.flickr.com/photos/asciella/
www.lastfm.it/user/qvaioe/
Ciao.
Guarda se questo può fare al caso tuo:
Codice PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
<script type="text/JavaScript">
function setOpacity(el,value) {
el.style.opacity = value/10;
el.style.mozOpacity = value/10;
el.style.filter = 'alpha(opacity=' + value*10 + ')';
}
function fade(){
var opt= 10;
var stop= 3;
var timeoutID = window.setInterval(f, 100);
var self= this;
function f(){
if(opt>stop){
opt--;
setOpacity(self,opt);
}
else {
window.clearTimeout(timeoutID);
}
}
}
window.onload= function(){
var mDiv= document.getElementById('myDiv');
mDiv.onclick=fade;
}
</script>
</head>
<body>
<div id="myDiv" style="width:300px;height:200px;background-color:#EE0000"></div>
</body>
</html>
![]()
Without faith, nothing is possible. With it, nothing is impossible
http://ilwebdifabio.it