〜私の記事ページ(http://www.adrtimes.squarespace.com/articles)では、各エントリはロールオーバー時に変化する画像で始まります。これは正常に機能しています。
ただし、私のホームページ(http://www.adrtimes.squarespace.com)では、ビデオとして分類されていない最新の2つの記事と、ビデオとしてタグ付けされている最新の2つの記事を読み込んでいます。jQuery load()を使用して、記事ページからコンテンツを取得しています。ホームページのswapImageロールオーバーを除いて、すべて問題なく動作します。swapImage関数をコールバックとして含めようとしましたが、コンテンツの両方のグループではなく、どちらか一方のグループのみが適切にロールオーバーします。何が問題なのかわからない!!
コードは次のとおりです。
<script type="text/javascript">
<!--
$(function(){
$.swapImage(".swapImage");
/* Homepage */
// load recent articles
$("#LoadRecentArticles").load("/articles/ .list-journal-entry-wrapper .journal-entry-wrapper:not(.category-video)", function(){
//callback...
$("#LoadRecentArticles .journal-entry-wrapper").wrapAll('<div class="list-journal-entry-wrapper" />');
$("#LoadRecentArticles .journal-entry-wrapper:gt(1)").remove();
// modify Read More tag
$('.journal-read-more-tag a:contains(Click to read more ...)').each(function(){
var str = $(this).html();
$(this).html(str.replace('Click to read more ...','Continue reading—'));
});
$.swapImage(".swapImage");
});
// load recent videos
$("#LoadRecentVideos").load("/articles/category/video .list-journal-entry-wrapper", function(){
//callback...
$("#LoadRecentVideos .journal-entry-wrapper:gt(1)").remove();
$('<div class="VideoTag">—video</div>').insertBefore("#LoadRecentVideos .category-video .body img");
// modify Read More tag
$('.journal-read-more-tag a:contains(Click to read more ...)').each(function(){
var str = $(this).html();
$(this).html(str.replace('Click to read more ...','Continue reading—'));
});
$.swapImage(".swapImage");
});
});
-->
</script>
そして、これが記事エントリの画像のhtmlのサンプルです。
<a href="/articles/2010/5/6/article-title-goes-here.html"><img class="swapImage {src: '/storage/post-images/Sample2_color.jpg'}" src="/storage/post-images/Sample2_bw.jpg" /></a>