• Javascript marquee help

    Maxim6m0cj Member

    I have a question i have some code posted down below it works but only after you move the mouse. i want it to run right away on page load.
    Here is HTML

    
    
    
          
          
            
           
          Ironton Firedepartment Zombie 5k Run
    
    
       
           
    date of race
    qrcode
    Heritage Mechicanical
    Runners Time:
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Here is Javascript

    here is the javascript:
    Code: Select all
    function objWidth(obj) {
       if(obj.offsetWidth)
       return  obj.offsetWidth;
       if (obj.clip) return obj.clip.width;
       return 0;}
       
       var mqr = [];
       function mq(id){this.mqo=document.getElementById(id);
       var wid = objWidth(this.mqo.getElementsByTagName('span')[0])+ 5; var fulwid = objWidth(this.mqo);
       var txt = this.mqo.getElementsByTagName('span')[0].innerHTML;
       this.mqo.innerHTML = '';
       var heit = this.mqo.style.height;
       this.mqo.onmouseout=function() {mqRotate(mqr);};
       this.mqo.onmouseover=function() {clearTimeout(mqr[0].TO);};
       this.mqo.ary=[]; var maxw = Math.ceil(fulwid/wid)+1;
       for (var i=0;i < maxw;i++){
          this.mqo.ary[i]=document.createElement('div');
          this.mqo.ary[i].innerHTML = txt; this.mqo.ary[i].style.position = 'absolute';
          this.mqo.ary[i].style.left = (wid*i)+'px';
          this.mqo.ary[i].style.width = wid+'px';
          this.mqo.ary[i].style.height = heit;
          this.mqo.appendChild(this.mqo.ary[i]);}
       mqr.push(this.mqo);}
       
       function mqRotate(mqr)
       {if (!mqr) return;
          for (var j=mqr.length - 1; j > -1; j--) {
             maxa = mqr[j].ary.length;
             for (var i=0;i
        
  • Abhey Member

    Just remove the two lines:

    new mq('m1');
    new mq('m2');
    

    and you will be good to go

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
en_USEnglish