コンテンツをフェードアウトしようとしsection#secondary
ています。コンテンツがフェードアウトされると、親(section#secondary
)はスライダーアニメーションで「shut」をアニメーション化する必要があります。
これはすべて機能していますが、期間は機能しておらず、理由がわかりません。
これが私のコードです:
HTML
<section id="secondary">
<a href="#" class="slide_button">«</a> <!-- slide in/back button -->
<article>
<h1>photos</h1>
<div class="album_nav"><a href="#">photo 1 of 6</a> | <a href="#">create an album</a></div>
<div class="bar">
<p class="section_title">current image title</p>
</div>
<section class="image">
<div class="links">
<a class="_back album_link" href="#">« from the album: james new toy</a>
<nav>
<a href="#" class="_back small_button">back</a>
<a href="#" class="_next small_button">next</a>
</nav>
</div>
<img src="http://localhost/~jannis/3781_doggie_wonderland/www/preview/static/images/sample-image-enlarged.jpg" width="418" height="280" alt="" />
</section>
</article>
<footer>
<embed src="http://localhost/~jannis/3781_doggie_wonderland/www/preview/static/flash/secondary-footer.swf" wmode="transparent" width="495" height="115" type="application/x-shockwave-flash" />
</footer>
</section> <!-- close secondary -->
jQuery
// =============================
// = Close button (slide away) =
// =============================
$('a.slide_button').click(function() {
$(this).closest('section#secondary').children('*').fadeOut('slow', function() {
$('section#secondary').animate({'width':'0'}, 3000);
});
});
の内容section#secondary
は可変なので、*
セレクターを使用します。
何が起こるかというと、fadeOut
は適切なslow
速度を使用しますが、コールバックが起動するとすぐに(コンテンツがフェードアウトすると)、アニメーションの継続時間を3000ミリ秒(3秒)ではなく、数ミリ秒以内にsection#secondary
アニメーション化します。width: 0
任意のアイデアをいただければ幸いです。
PS:現時点では例を投稿することはできませんが、これはjQueryの理論の問題であるため、ここでは例は必要ないと思います。私が間違っている場合は私を訂正してください。