marquee in javascript

Discussion in 'JavaScript' started by yonip, Apr 11, 2011.

  1. #1
    Hi,
    In my site I use marquee tag. My problem is that this tag is not standart.
    There is alternative in javascript?
    TIA.
     
    yonip, Apr 11, 2011 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cash Nebula, Apr 12, 2011 IP
  3. yonip

    yonip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    He use in the marquee tag' and this is not standart.
     
    yonip, Apr 12, 2011 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That's right, but you don't have to use a marquee tag. It's only there for people without Javascript.

    This is valid code that has no marquee tag, but the marquee function still works:
    
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
    <head profile='http://gmpg.org/xfn/11'>
    <title>Marquee Demo</title>
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
    <script type='text/javascript' src='jquery.marquee.js'></script>
    <script type='text/javascript'>
    	$(function () {
    		$('#foo').marquee();
    	});
    </script>
    </head>
    <body>
    <div id='foo'>This is a really long string to test the jQuery marquee plugin.</div>
    </body>
    </html>
    
    Code (markup):
     
    Cash Nebula, Apr 12, 2011 IP
  5. yonip

    yonip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks, it's work!
    only one more problem. its dont work with direction:rtl;
    can u help me?
    TIA
     
    yonip, Apr 12, 2011 IP
  6. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You can add direction attribute to the DIV, but the code will not validate.
    
    <div id='foo' [COLOR="red"]direction='right'[/COLOR]>This is a really long string to test the jQuery marquee plugin.</div>
    
    Code (markup):
    OR

    Open the script, go to line 103 and change 'left' to 'right'.
    
    direction = ($marquee.attr('direction') || '[COLOR="red"]right[/COLOR]').toLowerCase(),
    
    Code (markup):
    Not good to hack scripts, but it's only way I can make it work and validate.
     
    Cash Nebula, Apr 12, 2011 IP
  7. yonip

    yonip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks.
    P.S. are the plugin is Free License?
    I can use it free in my site and change this?
    and thanks again.;)
    edit: its not work.
     
    Last edited: Apr 13, 2011
    yonip, Apr 13, 2011 IP
  8. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Check that you have links to the jQuery library and marquee script in the head section.
    
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
    <script type='text/javascript' src='jquery.marquee.js'></script>
    
    Code (markup):
    Also, check that the marquee script is in the same directory as the page.
    That may be a problem if you are using Wordpress or other CMS.

    That's all I can do without a site link or some code.
     
    Cash Nebula, Apr 13, 2011 IP
  9. sugandp

    sugandp Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Use this code friend
    <marquee onMouseover="this.scrollAmount=3" onMouseout="this.scrollAmount=6">Scrolling text here. Scrolling text here</marquee>
     
    sugandp, Apr 19, 2011 IP