0

したがって、基本的には、テキストとブロック引用を含む引用と呼ばれる複数の div クラスがあります。5秒ごとに次の引用クラスにフェードするようにするにはどうすればよいですか?

マークアップは次のようになります。

<div id="quoteWrapper">
<div class="quote">

    <blockquote>Quote goes here</blockquote>

    <p class="quoteBy">Author</p>

</div>

<div class="quote">

    <blockquote>Second Quote goes here</blockquote>

    <p class="quoteBy">Author</p>

</div>

<div class="quote">

    <blockquote>Third Quote goes here</blockquote>

    <p class="quoteBy">Author</p>

</div>
</div>
4

1 に答える 1

1

ここに同様の質問があります。私がすることは、jquery を使用して現在の引用をフェードアウトし、コールバックで次の引用をフェードインする間隔を作成することです。これを行うには、クラスを追加して、現在表示されている見積もりを決定します

<div class="quote visible">

    <blockquote>Quote goes here</blockquote>

    <p class="quoteBy">Author</p>

</div>

<div class="quote">

    <blockquote>Second Quote goes here</blockquote>

    <p class="quoteBy">Author</p>

</div>

それから

setInterval(showQuote, 5000);

...

function showQuote() {
    // get visible quote
    $('.quote.visible').fadeOut(function() {
        // remove visible class from old quote and add it to new
        // get next quote and fadeIn() when fadeout finishes
    });
}
于 2012-11-05T01:06:46.960 に答える