jquery.timeago 插件:加载新内容后不会刷新模糊时间戳
我正在使用这个插件 https://github.com/rmm5t /jquery-timeago/blob/master/jquery.timeago.js
当我将新内容加载到 Dom 时,时间戳的自动刷新(以前的内容)停止工作(对于新加载的内容,仅适用)很好)...
我尝试在 document.ready 上使用 Livequery 的修改版本,但也不起作用。
加载新内容的函数是:
function reload_timeline(filter, more, update) {
if (update) {
$("#new_updates").hide();
}
beforeTimelineLoad(more, update);
$.post("/ajax/timeline_box_" + timeline_type + ".php", {
filter: filter,
timeline_type: timeline_type,
timeline_user_id: timeline_user_id,
smaller_id: timeline_smaller_id,
bigger_id: timeline_bigger_id,
start: timeline_start,
more: more,
update: update
}, function (data) {
if (data.length > 0 && timeline_type == "home") $("#pilltabs").show();
afterTimelineLoad(data, more, update, filter);
});
}
我尝试执行类似
$("abbr.timeago", data).timeago();
“afterTimelineLoad”函数中的操作,以应用timeago() 函数仅适用于数据中的新 abbr.timeago,但也不起作用...
我真的不知道该尝试什么...有任何线索吗?
I'm using this plugin https://github.com/rmm5t/jquery-timeago/blob/master/jquery.timeago.js
When I load new content to the Dom, the auto-refresh (of previous content) of the timestamps sstops working (with that new loaded content, works just fine)...
I tried to use a modified version with Livequery on document.ready, but didn't work either..
The function to load new content is:
function reload_timeline(filter, more, update) {
if (update) {
$("#new_updates").hide();
}
beforeTimelineLoad(more, update);
$.post("/ajax/timeline_box_" + timeline_type + ".php", {
filter: filter,
timeline_type: timeline_type,
timeline_user_id: timeline_user_id,
smaller_id: timeline_smaller_id,
bigger_id: timeline_bigger_id,
start: timeline_start,
more: more,
update: update
}, function (data) {
if (data.length > 0 && timeline_type == "home") $("#pilltabs").show();
afterTimelineLoad(data, more, update, filter);
});
}
I tried doing something like
$("abbr.timeago", data).timeago();
in the "afterTimelineLoad" function, to apply the timeago() function to only the new abbr.timeago in the data, but dind't work either...
I really don't know what to try... Any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能展示一下如何使用 livequery 的代码吗?
我就是这样使用的,效果很好。
can you show the code how u use the livequery?
i am using it this way and it works fine.