JavaScript realizes text seamless scrolling effect

Example of this article shared the text seamless scrolling effect for everyone, for your reference, the specific content is as follows

HTML

  
  • BKCSHC161014002153
  • ...
JS
$ (function () { Marquee ( “marquee”);}) // line rolling var Marquee = function (id) {var container = document.getElementById (id), original = container.getElementsByTagName ( “dt”) [0], clone = container.getElementsByTagName (“DD”) [0], Lilength = ORIGINAL.GETELEMENTSBYTAGNAME (“Li”). Length, Speed ​​= 55; IF (Lilength

  The above is this article ofAll content, I hope to help everyone, I hope everyone will support Tumi Clouds.  <=8){
        return
      }
      clone.innerHTML = original.innerHTML;

      var rolling = function(){
        if (container.scrollTop === clone.offsetHeight) {
          container.scrollTop = 0;
        }
        else {
          container.scrollTop++;
        }
      }
      var timer = setInterval(rolling, speed)//设置定时器
      container.onmouseover = function(){
        clearInterval(timer)
      }//鼠标移到marquee上时,清除定时器,停止滚动
      container.onmouseout = function(){
        timer = setInterval(rolling, speed)
      }//鼠标移开时重设定时器
    }    
                     
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment