【发布时间】:2014-03-10 14:18:43
【问题描述】:
我使用插件 Infinite Scroll for wordpress,效果很好。 但我也使用插件 Inline Ajax Comment,它在每个帖子上以 ajax 显示 cmets。
它不适用于无限滚动中的帖子,因为脚本需要回调。
所以我使用这个回调: ajaxLoadedCallback();
因为在 inline cmets 的 script.js 中,我可以看到:
// BETA: If newly loaded Ajax content has javascript then execute.
// This helps inline-ajax-comments work if loaded by something like Infinite Scroll.
// You MUST run this callback after ajax success. see jQuery docs.
function ajaxLoadedCallback() {
scriptx = document.getElementsByTagName("script");
scripts = new Array();
for (var idx=0; idx<scriptx.length; idx++) {
if (jQuery(scriptx[idx]).is(".inline-comments-script")) {
scripts.push(scriptx[idx].innerHTML);
}
}
但是 cmets 没有加载...
有人有想法吗?
谢谢。
内联 Ajax 评论:http://wordpress.org/plugins/inline-ajax-comments/
【问题讨论】:
标签: jquery ajax wordpress callback jquery-callback