开发者

jQuery animation if load() returns something different

setInterval(function() {
                var prevTopArticle = $("#toparticles table:first").html();
                  $("#toparticles").load("myurloffeed.com/topfeed", function()
                   {
                       alternateBG();
              开发者_如何学Python         var newTopArticle = $("#toparticles table:first").html();
                            if (prevTopArticle!=newTopArticle)
                                {
                                     $("#toparticles table:first").effect("highlight", {color:"#faffc4"}, 2000);
                                }
                  });
                }, 8000);

So it sets the current first table item to a variable, loads the toparticles div with the tables off the url, and if they are different it will perform the highlight effect, however it does the highlight effect anyway, completely unsure why it isn't working.


For some reason one of the articles was outputting a twitter link and the other wasn't, thought the feeds were the same. Figured it out using console.log of the two variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜