Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »


1.5.0 • Public • Published

jQuery-Marquee with CSS3 Support

A 5.56 KB (minified) jQuery plugin to scroll the text like the old traditional marquee.


<script src="//cdn.jsdelivr.net/npm/jquery.marquee@1.5.0/jquery.marquee.min.js" type="text/javascript"></script>
  • Bower: bower install jQuery.Marquee
  • Download: zip



  • allowCss3Support If you wish the plugin should animate always using jQuery animate method even if browser supporst CSS3 animations. Default is true
  • css3easing Works when allowCss3Support is set to true - for full list see: http://www.w3.org/TR/2013/WD-css3-transitions-20131119/#transition-timing-function . Default is 'linear'
  • easing Requires jQuery easing plugin http://gsgd.co.uk/sandbox/jquery/easing/. Default is 'linear'
  • delayBeforeStart Time in milliseconds before the marquee starts animating. Default is 1000
  • direction Direction towards which the marquee will animate 'left' / 'right' / 'up' / 'down'. Default is 'left'. Todo: need to change this to ltr/rtl etc
  • duplicated Should the marquee be duplicated to show an effect of continuous flow. Use this only when the text is shorter than the container. Default is false
  • duration Duration in milliseconds in which you want your element to travel. Default is 5000.
  • speed Speed will override duration. Speed allows you to set a relatively constant marquee speed regardless of the width of the containing element. Speed is measured in pixels per second.
  • gap Gap in pixels between the tickers. Will work only when the duplicated option is set to true. Default is 20. Note: 20 means 20px so no need to use '20px' as the value.
  • pauseOnHover On hover pause the marquee. If browser supports CSS3 and allowCss3Support is set to true than it will be done using CSS3. Otherwise this will be done using jQuery plugin https://github.com/tobia/Pause. Default is false. Check the demo page for a demo.
  • pauseOnCycle On cycle, pause the marquee for delayBeforeStart milliseconds.
  • startVisible The marquee will be visible in the start if set to true. Thanks to @nuke-ellington 👍


  • beforeStarting: Event will be fired on the element before animation starts.
  • finished: Event will be fired on the element after the animation finishes.
  • paused: Event will be fired on the element when the animation is paused.
  • resumed: Event will be fired on the element when the animation is resumed.


These methods can be used like this:

  • First initialize marquee with any options var $mq = $('.marquee').marquee();
  • Then at any time you can call following methods var $mq.marquee('NAME-OF-METHOD-AS-STRING');

Here is the list of all methods:

  • pause: To pause the marquee at any time.
  • resume: To resume the marquee after being paused previously.
  • toggle: To toggle between pause and resume methods.
  • destroy: To remove marquee plugin from your element. This method is useful if you are loading/changing the data using Ajax or just another string. You can combine this with finished event so you can let marquee to show some data and soon it finishes showing, you can destroy it, change the html and than apply the plugin again. See the demo page for details (links provided above).



<div class='marquee'>Lorem ipsum dolor sit amet, consectetur adipiscing elit END.</div>

or use this if you want to start the plugin with no options but want to use data attributes. You can use all the options listed above as data attributes. This is how you can use them:

<div class='marquee' data-duration='5000' data-gap='10' data-duplicated='true' >
    Lorem ipsum dolor sit amet, consectetur adipiscing elit END.


.marquee {
  width: 300px; /* the plugin works for responsive layouts so width is not necessary */
  overflow: hidden;
  border:1px solid #ccc;

How to apply plugin:

 * Example of starting a plugin with options.
 * I am just passing some of the options in the following example.
 * you can also start the plugin using $('.marquee').marquee(); with defaults
    //duration in milliseconds of the marquee
    duration: 15000,
    //gap in pixels between the tickers
    gap: 50,
    //time in milliseconds before the marquee will start animating
    delayBeforeStart: 0,
    //'left' or 'right'
    direction: 'left',
    //true or false - should the marquee be duplicated to show an effect of continues flow
    duplicated: true

How to use methods:

var $mq = $('.marquee').marquee();

Change content and re-apply the plugin. Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples

    .bind('finished', function(){
        //Change text to something else after first loop finishes
        //Load new content using Ajax and update the marquee container
        $(this).html('Some new data loaded using ajax')
            //Apply marquee plugin again

How to use events:

Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples

    .bind('beforeStarting', function () {
        //code you want to execute before starting the animations
    .bind('finished', function () {
        //code you want to execute before after each animation loop
    //Apply plugin
        duration: 2000


If you are using images in marquee, sometimes the plugin cannot calculate accurate widths while images are still loading. You can try this instead of $(document).ready(function(){...})

//if you have images in marquee
$(window).load(function() {


Update (8 Mar 2016): Now plugin have new option: startVisible The marquee will be visible in the start if set to true. Thanks to @nuke-ellington 👍

Update (24 Jan 2014):

Note: people who been asking me how to use this plugin with content being loaded with Ajax, please read notes about this update.

  • New methods added, so now after you start the plugin using var $mq = $('.marquee').marquee();, then you can pause, resume, toggle(pause, resume) and destroy methods e.g to remove the marquee plugin from your element simply use $mq.marquee('destroy');. Similarly you can use pause the marquee any time using $mq.marquee('pause');.

  • If you want to use use Ajax with this plugin i.e you want to change the content after you apply this plugin, please see the examples in demo page (link provided below).

  • Also made some changes so this plugin works with old versions of jQuery. I have tested it with jQuery 1.3.2 but quite sure it should work with some previous versions of jQuery.

PLEASE report any bugs you find.

For details please check the demos at: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples

Update (20 Dec 2013): Now the plugin will detect if browser supports CSS3 animations than it will animate the element using CSS3 which will perform much better than animating using jQuery.

The pauseOnHover also works using CSS3. The plugin just prepares the setup and required CSS3 animation CSS.

Due to some reasons if you want plugin to animate always using jQuery than you need to set allowCss3Support option to false. Also an extra option css3easing is added.

Check demo page for example: http://aamirafridi.com/jquery/jquery-marquee-plugin#examples

Update (27 Nov 2013): Easing option added. Requires jQuery easing plugin.

Update (22 Nov 2013): Now plugin supports the 'up' and 'down' directions. Please have a look at the example to see how to use.

Update (21 Aug 2013): If you want to hide the marquee for certain devices, try using visibility: hidden with height: 0 & position: absolute instead of display: none because jQuery cannot calculate with width etc of hidden elements. For more details:

Update (22 Feb 2013): pauseOnHover option added. Please note that you will need to include jQuery pause plugin: https://github.com/tobia/Pause before the jQuery Marquee plugin.

Update (20 Feb 2013):


npm i jquery.marquee

DownloadsWeekly Downloads






Last publish


  • avatar