Ver Mensaje Individual
  #7 (permalink)  
Antiguo 24/03/2012, 12:05
Greca
 
Fecha de Ingreso: mayo-2010
Ubicación: Madrid
Mensajes: 19
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: scroll de noticias vertical

Por si acaso, pasteo el código tal cual lo estoy usando:

Código CSS:
Ver original
  1. #marqueecontainer{
  2. position: relative;
  3. width: 266px; /*marquee width */
  4. height: 200px; /*marquee height */
  5. background-color: white;
  6. overflow: hidden;
  7. padding: 2px;
  8. padding-left: 4px;
  9. }

Código Javascript:
Ver original
  1. /***********************************************
  2. * Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
  3. * This notice MUST stay intact for legal use
  4. * Visit http://www.dynamicdrive.com/ for this script and 100s more.
  5. ***********************************************/
  6.  
  7. var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
  8. var marqueespeed=1.5 //Specify marquee scroll speed (larger is faster 1-10)
  9. var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?
  10.  
  11. ////NO NEED TO EDIT BELOW THIS LINE////////////
  12.  
  13. var copyspeed=marqueespeed
  14. var pausespeed=(pauseit==0)? copyspeed: 0
  15. var actualheight=''
  16.  
  17. function scrollmarquee(){
  18. if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
  19. cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
  20. else
  21. cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
  22. }
  23.  
  24. function initializemarquee(){
  25. cross_marquee=document.getElementById("vmarquee")
  26. cross_marquee.style.top=0
  27. marqueeheight=document.getElementById("marqueecontainer").offsetHeight
  28. actualheight=cross_marquee.offsetHeight
  29. if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
  30. cross_marquee.style.height=marqueeheight+"px"
  31. cross_marquee.style.overflow="scroll"
  32. return
  33. }
  34. setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
  35. }
  36.  
  37. if (window.addEventListener)
  38. window.addEventListener("load", initializemarquee, false)
  39. else if (window.attachEvent)
  40. window.attachEvent("onload", initializemarquee)
  41. else if (document.getElementById)
  42. window.onload=initializemarquee

Código HTML:
Ver original
  1. <div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
  2. <div id="vmarquee" style="position: absolute; width: 98%;">
  3.  
  4. <!--YOUR SCROLL CONTENT HERE-->
  5.  
  6. Aquí va todo el contenido que obvio para no sobrecargar innesariamente, ya que es todo texto.
  7.  
  8. <!--YOUR SCROLL CONTENT HERE-->
  9.  
  10. </div>
  11. </div>