javascript之水平横向滚动歌词同步的应用

2019-06-02 20:35:49于丽

    clearTimeout(lrc0);
    if(curdlt>0) lowcolor(eval("lrcbc"+curdlt));
    lowcolor(eval("lrcbc"+(curdlt+1)));
    lowlight(eval("lrcbox"+(curdlt+1)));
    if(lrcoll.style.pixelTop>120-top*20) lrcoll.style.top = 120-top*20;
    if(lrcoll.style.pixelTop<120-bottom*20) lrcoll.style.top = 120-bottom*20;
    s_y = event.clientY;
    o_y = lrcoll.style.pixelTop;
    element.style.cursor = "n-resize";
    element.setCapture();
    moveflag = true;
  }

  function onmousemove()
  {
    if(event.button!=1 || !moveflag || flagmove) return;
    var offy = event.clientY-s_y;
    if(o_y+offy<=120-top*20 && o_y+offy>=120-bottom*20) lrcoll.style.top = o_y+offy;
    if(o_y+offy>120-top*20) lrcoll.style.top = 120-top*20;
    if(o_y+offy<120-bottom*20) lrcoll.style.top = 120-bottom*20;
    var pot = Math.floor((lrcoll.style.pixelTop-120)/-20);
    if(pot!=curpot)
    {
      lowlight(eval("lrcbox"+(curpot+1)));
      curpot = pot;
      highlight(eval("lrcbox"+(curpot+1)));
    }
  }

  function onmouseup()
  {
    if(!moveflag || flagmove) {flagmove = false; return;}
    if(aboutplayer.playState==3)
    {
      if(lrcoll.style.pixelTop<=120-top*20 && lrcoll.style.pixelTop>100-top*20)
        lrcobj.dte = -1;
      else
        lrcobj.dte = lrcobj.inr[Math.floor((lrcoll.style.pixelTop-120)/-20)-1].t[0];
      if(lrcobj.inr[Math.floor((lrcoll.style.pixelTop-120)/-20)].t[0]-ffbb<0)
        aboutplayer.controls.currentPosition = 0;
      else
        aboutplayer.controls.currentPosition = lrcobj.inr[Math.floor((lrcoll.style.pixelTop-120)/-20)].t[0]-ffbb;
      lrcobj.dlt = Math.floor((lrcoll.style.pixelTop-120)/-20);
      lrctop = lrcoll.style.pixelTop;