Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a solution. Made possible through the use of jQuery <a href="http://api.jquery.com/slideUp/" rel="nofollow">slideUp()</a> and <a href="http://api.jquery.com/slideDown/" rel="nofollow">slideDown()</a>. Additionally to allow for the animation to run every few seconds, I employed standard javascript <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window.setInterval" rel="nofollow">setInterval()</a>.</p> <p>HTML &amp; JS</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="//code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Build something...&lt;/h1&gt; &lt;h1 id="marqueeText"&gt;Testing&lt;/h1&gt; &lt;button id="foo"&gt;Foo&lt;/button&gt; &lt;script&gt; $(document).ready(function() { // Drumroll, the main function that will start the rolling text. var drumrollPlease = function() { var index = 0; var words = ['Awesome', 'Fun', 'Amazing']; var marquee = $('#marqueeText'); // Key part here. This is the heart of the script, where your words will get rotated through, // animating with slideup/slidedown and changing out your words based on the above words array. window.setInterval(function () { // Reset to the beginning once we reach end of our words list. if (index &gt;= words.length) { index = 0; } // Set the marquee container to slide, update the word in our marquee container and then slide back down to reveal // the new word. marquee.slideUp('slow', function() { marquee.html(words[index++]); marquee.slideDown(); }); }, 2000); // Modify this duration in milliseconds as you please. } // I bound my button foo to illustrate how to trigger it. I could // just as easily have called drumrollPlease() to have the function auto run // when the document was in the ready state. $('#foo').click(function() { drumrollPlease(); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>See button activated plunker version: <a href="http://plnkr.co/edit/O5Gi1DbBrx7j9TazWXja" rel="nofollow">HERE</a></p> <p>See automatic activated plunker version: <a href="http://plnkr.co/edit/uJLkIDkoDiNjxW8p6t0f?p=preview" rel="nofollow">HERE</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload