0

我从网上找到的代码中构建了一个带有淡入的旋转文本,我只有基本的代码理解。

quote[2] 需要三行,而其他行只需要两行,因此它会在旋转时上下移动下面的站点。无论如何要
在这段代码中设置一半,这样我就可以在句子的上方和下方有一半的空间?或仅将第三个引号居中。

我尝试了一个带有 span 0.5em 方法的 css,但 span 在这段代码的其余部分中不起作用。

谢谢

(网站是 www.focallocal.org)

<DIV id=textrotator style="FONT: 18px arial ; text-align:centre; WIDTH: 100%; COLOR: rgb(255,255,255)"></DIV>
  <body bgcolor="#FFFFFF" alink="#FFFFFF" vlink="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0">
  <script type = "text/javascript">
    var hexinput = 255; // initial color value.

    quotation = new Array()
    quotation[0] = "<br />A simple and fun way to make the world and your community a happier, more connected place in your free time<br /><br />" 
    quotation[1] = "<br />Discover how you can shape the world in your spare time through Collective Action<br /><br />"
    quotation[2] = "Bringing people and their communities closer together and dealing with serious societal issues in a constructive, light-hearted, adventurous and enjoyable way"

    function fadingtext()
    { 
      if(hexinput >111) 
      { 
        hexinput -=11; // increase color value
        document.getElementById("textrotator").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; // Set color value.
        setTimeout("fadingtext()",300); // 300ms per step
      }
      else 
      {
        hexinput = 255; //reset hex value
      }
    }

 var which = 0;

function changetext()
{
    which += 1; 
    if (which >= quotation.length)
    {
        which = 0;
    }

    document.getElementById("textrotator").innerHTML = quotation[which]; 

    fadingtext();

    setTimeout("changetext()",8000);
}

    window.onload = changetext();
  </script></div>
4

0 回答 0