Results 1 to 4 of 4

Thread: Cross Browser Marquee

  1. #1
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Cross Browser Marquee

    1) Script Title: Cross Browser Marquee

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/cmarquee.htm

    3) Describe problem: I am using the marquee on a responsive page ("max-width:xxpx" in css).
    I want the marquee's width to follow the fluid width of the div.
    How do I make it do that?
    Thank you in advance for your help.

  2. #2
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    I think that is what you are looking for...
    Code:
    "max-width: "+document.getElementById("mydiv").offsetWidth+"px"
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  3. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    that is a very old script

    try

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    
    .marquee {
     position:relative;overflow:hidden;width:40%;height:30px;background-Color:#FFFF66;border:solid red 1px;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <div id="marquee1" class="marquee"
     onmouseover="zxcMarquee.Speed('marquee1',0);"
     onmouseout="zxcMarquee.Speed('marquee1',-2);"
    >
    <div><span><nobr><font face="Arial">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider linking to us by <a href="../link.htm">click here.</a> Enjoy your stay!</font></nobr></span> </div>
    </div>
    <br />
    <div id="marquee2" class="marquee" style="width:40%;"
     onmouseover="zxcMarquee.Speed('marquee2',2);"
     onmouseout="zxcMarquee.Speed('marquee2',0);"
    >
    <div><span><nobr><font face="Arial">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider linking to us by <a href="../link.htm">click here.</a> Enjoy your stay!</font></nobr></span> </div>
    </div>
    
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    var zxcMarquee={
    
     Speed:function(id,s){
      var o=this['zxc'+id];
      if (o){
       o.s=typeof(s)=='number'?s:0;
       this.scroll(o);
      }
      else {
       this.init({ID:id,Speed:s});
      }
     },
    
     init:function(o){
      var p=document.getElementById(o.ID),s=o.Speed,b=p?p.getElementsByTagName('DIV')[0]:null,c=b?b.lastChild:null,c=c&&c.nodeType!=1?c.previousSibling:c;
      if (c&&c.nodeType==1&&!this['zxc'+o.ID]){
       p.style.overflow='hidden';
       b.style.position='absolute';
       o.mx=c.offsetLeft+c.offsetWidth;
       o.p=p;
       o.b=b;
       o.n=b.offsetLeft;
       zxcMarquee['zxc'+o.ID]=o;
       o.s!=0?this.Speed(o.ID,s):null;
      }
     },
    
     scroll:function(o){
      var pw=o.p.offsetWidth,n=o.n+o.s,n=o.s>0&&n>pw?n-o.mx-pw:o.s<0&&n<-o.mx?pw:n;
      clearTimeout(o.to);
      if (o.s!=0){
       o.b.style.left=n+'px';
       o.n=n
       o.to=setTimeout(function(){ zxcMarquee.scroll(o); },30);
      }
     }
    
    }
    
    zxcMarquee.init({
     ID:'marquee1',
     Speed:-2
    });
    /*]]>*/
    </script></body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  4. #4
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you both for your kind help. Much appreciated.

Similar Threads

  1. Cross Browser marquee II Help
    By ECDRN in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 05-27-2009, 01:08 PM
  2. Cross browser Marquee II
    By stephsmarti in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 07-29-2006, 09:50 AM
  3. Cross Browser marquee
    By alhakeem2001 in forum JavaScript
    Replies: 2
    Last Post: 07-03-2006, 10:53 AM
  4. Cross Browser marquee II
    By wizzkid in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-21-2006, 06:06 AM
  5. Cross Browser marquee II
    By Acquizeta in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-02-2005, 07:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •