开发者

jQuery animation if load() returns something different

开发者 https://www.devze.com 2023-01-31 20:06 出处:网络
setInterval(function() { var prevTopArticle = $(\"#toparticles table:first\").html(); $(\"#toparticles\").load(\"myurloffeed.com/topfeed\", function()
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

精彩评论

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