Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/11/2010, 09:16
txemaker
 
Fecha de Ingreso: octubre-2007
Mensajes: 74
Antigüedad: 17 años, 4 meses
Puntos: 1
Respuesta: Por favor ayuda con este codigo

Bueno pues respondiendome a mi mismo he encontrado una capa deslizante que funciona con firefox, muy parecido al que estaba utilizando y quiza el mismo y el que estuve utilizando tuviera algún error, ahi va:

Cita:
<html>
<head>
<title>Efecto 1</title>

<style type='text/css'>
#capa {font-family:Arial; font-size:12px;}
</style>

</head>

<body>

<div id="capa" style="position:absolute; left:20px; top:0px; width:250px; color:#555555;">Aqui va el texto que quieras mostrar...</div>

<script language="JavaScript" type="text/javascript">

var capa =
{
topMargin : 25, //posicion inicial
ceiling : 55, //pixels del efecto de amortiguacion
desplazaTime : 1200, //tiempo en recorrer la distancia anterior
capaDiv : document.all ? document.all.capa :
(document.layers ? document.capa : document.getElementById('capa'))
}

window.setInterval("capa.coordenadas( )", 35)

capa.coordenadas = function( )
{
if(document.all)
{
this.actualY = this.capaDiv.style.pixelTop;
this.scrollTop = document.body.scrollTop;
}
else if(document.layers)
{
this.actualY = this.capaDiv.top;
this.scrollTop = window.pageYOffset;
}
else if(document.getElementById)
{
this.actualY = parseInt(this.capaDiv.style.top);
this.scrollTop = window.pageYOffset;
}

var nuevoScrollTop = Math.max( this.scrollTop + this.topMargin, this.ceiling );

if ( this.actualY != nuevoScrollTop )
{
if ( nuevoScrollTop != this.targetY )
{
this.targetY = nuevoScrollTop;
this.desplazaInit( );
}
this.desplaza( );
}
}

capa.desplazaInit = function( )
{
var ahora = new Date( )
this.A = this.targetY - this.actualY ;
this.B = Math.PI / ( 2 * this.desplazaTime );
this.C = ahora.getTime( );
this.D = this.actualY;
}

capa.desplaza = function( )
{
var ahora = new Date( );
var nuevaY = this.A * Math.sin( this.B * ( ahora.getTime( ) - this.C ) ) + this.D;
nuevaY = Math.round( nuevaY );

if ( ( this.A > 0 && nuevaY > this.actualY ) || ( this.A < 0 && nuevaY < this.actualY ) )
{
if (document.all)
this.capaDiv.style.pixelTop = nuevaY;
else if(document.layers)
this.capaDiv.top = nuevaY;
else if(document.getElementById)
this.capaDiv.style.top = nuevaY;
}
}

</script>

<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br>

</body>
</html>
Fuente: http://www.terra.es/personal2/pagina...r/capadesl.htm

Espero que sirva de ayuda, un saludo a todos