Skip to content Skip to sidebar Skip to footer

How To Remove Trailing Space From Marquee?

I Develop a marquee which continuously moves to upward direction. But what the exact problem is after finishing scrolling last image there is a huge gap between first image and las

Solution 1:

Remove the last <br> from your marquee should do it, plus check your css and make sure that there is no margin added to images there.

As others have pointed out, using the <marquee> tag is really bad practice nowadays. There are lots of very nice jquery marquee plugins if you have a look around.

Solution 2:

<!DOCTYPE htmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"><head><title></title><styletype="text/css">.container{
position: relative;
width: 200px; /*marquee width */height: 200px; /*marquee height */overflow: hidden;
background-color: white;
border: 3px solid orange;
padding: 2px;
padding-left: 4px;
}

</style><scripttype="text/javascript">var zxcMarquee={

 init:function(o){
  var mde=o.Mode,mde=typeof(mde)=='string'&&mde.charAt(0).toUpperCase()=='H'?['left','offsetWidth','top','width']:['top','offsetHeight','left','height'],id=o.ID,srt=o.StartDelay,ud=o.StartDirection,p=document.getElementById(id),obj=p.getElementsByTagName('DIV')[0],sz=obj[mde[1]],clone;
  p.style.overflow='hidden';
  obj.style.position='absolute';
  obj.style[mde[0]]='0px';
  obj.style[mde[3]]=sz+'px';
  clone=obj.cloneNode(true);
  clone.style[mde[0]]=sz+'px';
  clone.style[mde[2]]='0px';
  obj.appendChild(clone);
  o=this['zxc'+id]={
   obj:obj,
   mde:mde[0],
   sz:sz
  }
  if (typeof(srt)=='number'){
   o.dly=setTimeout(function(){ zxcMarquee.scroll(id,typeof(ud)=='number'?ud:-1); },srt);
  }
  else {
   this.scroll(id,0)
  }
 },

 scroll:function(id,ud){
  var oop=this,o=this['zxc'+id],p;
  if (o){
   ud=typeof(ud)=='number'?ud:0;
   clearTimeout(o.dly);
   p=parseInt(o.obj.style[o.mde])+ud;
   if ((ud>0&&p>0)||(ud<0&&p<-o.sz)){
    p+=o.sz*(ud>0?-1:1);
   }
   o.obj.style[o.mde]=p+'px';
   o.dly=setTimeout(function(){ oop.scroll(id,ud); },50);
  }
 }
}

functioninit(){

 zxcMarquee.init({
  ID:'marquee1',     // the unique ID name of the parent DIV.                        (string)Mode:'Vertical',   //(optional) the mode of execution, 'Vertical' or 'Horizontal'. (string, default = 'Vertical')StartDelay:2000,   //(optional) the auto start delay in milli seconds'.            (number, default = no auto start)StartDirection:-1//(optional) the auto start scroll direction'.                  (number, default = -1)
 });

 zxcMarquee.init({
  ID:'marquee2',     // the unique ID name of the parent DIV.                        (string)Mode:'Horizontal', //(optional) the mode of execution, 'Vertical' or 'Horizontal'. (string, default = 'Vertical')StartDelay:2000,   //(optional) the auto start delay in milli seconds'.            (number, default = no auto start)StartDirection:-1//(optional) the auto start scroll direction'.                  (number, default = -1)
 });

}

if (window.addEventListener)
 window.addEventListener("load", init, false)
elseif (window.attachEvent)
 window.attachEvent("onload", init)
elseif (document.getElementById)
 window.onload=init


</script></head><body><divid="marquee1"class="container"onmouseover="zxcMarquee.scroll('marquee1',0);"onmouseout="zxcMarquee.scroll('marquee1',-1);"><divstyle="position: absolute; width: 98%;"><pstyle="margin-top: 0"><b><ahref="http://www.dynamicdrive.com/dynamicindex17/indexb.html">Iframe &amp;
Ajax category added</a></b><br>
The Dynamic Content category has just been branched out with a new
<ahref="http://www.dynamicdrive.com/dynamicindex17/indexb.html">sub category</a>
to better organize its scripts.</p><p><b><ahref="http://tools.dynamicdrive.com/gradient/">Gradient Image Maker</a></b><br>
We're excited to introduce our latest web tool- Gradient Image Maker!</p><p><b><ahref="http://www.dynamicdrive.com/forums/">DD Help Forum</a></b><br>
Check out our new forums for help on our scripts and coding in general.</p><palign="left"><b><ahref="http://www.dynamicdrive.com/notice.htm">Terms of
Usage update</a></b><br>
Please review our updated usage terms regarding putting our scripts in an
external .js file. </p></div></div><divid="marquee2"class="container"onmouseover="zxcMarquee.scroll('marquee2',0);"onmouseout="zxcMarquee.scroll('marquee2',-1);"><divstyle="position: absolute; width: 98%;"><pstyle="margin-top: 0"><b><ahref="http://www.dynamicdrive.com/dynamicindex17/indexb.html">Iframe &amp;
Ajax category added</a></b><br>
The Dynamic Content category has just been branched out with a new
<ahref="http://www.dynamicdrive.com/dynamicindex17/indexb.html">sub category</a>
to better organize its scripts.</p><p><b><ahref="http://tools.dynamicdrive.com/gradient/">Gradient Image Maker</a></b><br>
We're excited to introduce our latest web tool- Gradient Image Maker!</p><p><b><ahref="http://www.dynamicdrive.com/forums/">DD Help Forum</a></b><br>
Check out our new forums for help on our scripts and coding in general.</p><palign="left"><b><ahref="http://www.dynamicdrive.com/notice.htm">Terms of
Usage update</a></b><br>
Please review our updated usage terms regarding putting our scripts in an
external .js file. </p></div></div></body></html>

Post a Comment for "How To Remove Trailing Space From Marquee?"