setInterval(function() {
var prevTopArticle = $("#toparticles table:first").html();
$("#toparticles").load("myurloffeed.com/topfeed", function()
{
alternateBG();
var newTopArticle = $("#toparticles table:first").html();
if (prevTopArticle!=newTopArticle)
{
$("#toparticles table:first").effect("highlight", {color:"#faffc4"}, 2000);
}
});
}, 8000);
因此它将当前的第一个表项设置为一个变量,从 url 中加载带有表的 toparticles div,如果它们不同,它将执行突出显示效果,但是无论如何它都会执行突出显示效果,完全不确定为什么不工作。
最佳答案
出于某种原因,其中一篇文章输出了 Twitter 链接,而另一篇则没有,认为提要是相同的。使用两个变量的 console.log 计算出来。
关于javascript - jQuery 动画如果 load() 返回不同的东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4499505/