I have a .txt file that I need to include into a page, that gets dynamically updated every 5 seconds, so I need to refresh it via ajax, so that the updated content can be seen without refreshing the page. I want to do it so it fades into the div, with every 5 second update.
我有一个.txt文件,我需要包含在页面中,每5秒动态更新一次,所以我需要通过ajax刷新它,以便可以看到更新的内容而无需刷新页面。我想这样做,所以它逐渐淡入div,每5秒更新一次。
Currently Im doing it like this, which is pretty ugly looking
目前我这样做,看起来很难看
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 个解决方案
#1
I think you want to create a Digg Spy-like effect, check this demo.
我想你想要创建类似Digg Spy的效果,请查看此演示。
Check also this article/screencast: Simple jQuery Spy Effect
另请参阅本文/截屏视频:简单的jQuery间谍效果
#1
I think you want to create a Digg Spy-like effect, check this demo.
我想你想要创建类似Digg Spy的效果,请查看此演示。
Check also this article/screencast: Simple jQuery Spy Effect
另请参阅本文/截屏视频:简单的jQuery间谍效果