How do I make the correct fadein to dynamically update content using jquery?
I have a .txt file that I need to include in a page that dynamically refreshes every 5 seconds, so I need to refresh it with ajax so that the updated content can be seen without refreshing the page. I want to make it disappear into the div, every 5 seconds of refresh.
I am currently doing it in a way that looks pretty ugly
function getSearches() {
$("#latest_searches").animate({
opacity: 0.3
}, 1000 );
$("#latest_searches").load("_latest_searches.php", '', callback);
}
function callback() {
$("#latest_searches").animate({
opacity: 1
}, 1000 );
setTimeout("getSearches();", 5000);
}
$(document).ready(getSearches);
+1
user15063
source
to share
1 answer
I think you want to create a Digg Spy-like effect , check out this demo .
See also this article / screencast: Simple jQuery Spy Effect
+1
source to share