SO - 23588551

by Arun P Johny

HTML

<div id="quote1">
    <span class="quote">I am a quote</span>
    <span class="author">Author Name</span>
</div>

<div id="quote2">I am another quote</div>

<div id="quote3">I am yet another quote</div>

JavaScript

jQuery(function () {
    var $els = $('div[id^=quote]'),
        i = 0,
        len = $els.length;

    $els.slice(1).hide();
    setInterval(function () {
        $els.eq(i).fadeOut(function () {
            i = (i + 1) % len
            $els.eq(i).fadeIn();
        })
    }, 2500)
})