〜在我的文章页面(http://www.adrtimes.squarespace.com/articles)我的每个条目都是以翻转时变化的图像开始的。这工作正常。问题jQuery swapImage();
但是,在我的主页(http://www.adrtimes.squarespace.com)中,我加载了最近两篇未归类为视频的文章以及最近被标记为视频的两篇文章。我正在使用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>
我不知道该插件的任何(其他比我看了看刚才),但会不会是它会很困惑,因为你使用的是完全相同的图像' src'两套掉期?你可以尝试给不想交换的图像指定一个独特的名称,看看是否有帮助? (基本上用新名称复制图像。)我可以从Firebug中突出显示的代码中看到,当您悬停时,图像的“src”会发生变化。但它似乎只是给它两个不起作用的原始'src'。 – user113716 2010-05-20 02:01:40
看来,文章页面(http://www.adrtimes.squarespace.com)会有相同的问题,如果它是由使用相同的图像造成的......但我试过了,并设置它,使所有的图片加载进入主页都有独特的名称 - 但没有工作。 :( – VUELA 2010-05-20 02:15:52
出于好奇,这是'{src:'/storage/post-images/Sample2_color.jpg'}'由你或插件添加吗? – user113716 2010-05-20 02:20:22